Inheritance—Creating a VerifiedUser
Learn what inheritance is and how we can use it in Chirpy.
We'll cover the following
Right now, all users on Chirpy are the same—whether they are regular users or verified ones. But just like in real-world social networks, some users need to stand out. Verified users bring credibility and recognition to the platform, making their presence more distinct.
To reflect this, Chirpy also recognizes verified users, giving them:
A verification badge to indicate their authenticity.
Special privileges—perhaps their posts appear more prominently.
Now, we could solve this problem by adding an extra attribute like is_verified
to our User
class, but this approach comes with some major drawbacks.
Take a moment to reflect: What potential drawbacks might arise from this approach? Jot down your ideas in the widget below.
Create a free account to view this lesson.
Continue your learning journey with a 14-day free trial.
By signing up, you agree to Educative's Terms of Service and Privacy Policy