Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Challenge: Admin | Inheritance
In-Depth Python OOP

Challenge: Admin

Task

You have a User class from the last challenge.
The methods are corrected (User -> {self.username} in strings).
Let's define the Admin class!

  1. Define the Admin class inherited from the User class.
  2. Define the create_content() admin's method that prints the string:
    f"{self.username} creates the content".
  3. Define the update_content() admin's method that prints the string:
    f"{self.username} updates the content".
  4. Define the delete_content() admin's method that prints the string:
    f"{self.username} deletes the content".

Note

Admin has all the capabilities of User that do not need to be reimplemented. This is an example of how inheritance makes our life easier.

Everything was clear?

Section 2. Chapter 2
toggle bottom row
course content

Course Content

In-Depth Python OOP

Challenge: Admin

Task

You have a User class from the last challenge.
The methods are corrected (User -> {self.username} in strings).
Let's define the Admin class!

  1. Define the Admin class inherited from the User class.
  2. Define the create_content() admin's method that prints the string:
    f"{self.username} creates the content".
  3. Define the update_content() admin's method that prints the string:
    f"{self.username} updates the content".
  4. Define the delete_content() admin's method that prints the string:
    f"{self.username} deletes the content".

Note

Admin has all the capabilities of User that do not need to be reimplemented. This is an example of how inheritance makes our life easier.

Everything was clear?

Section 2. Chapter 2
toggle bottom row
some-alt