Зміст курсу
In-Depth Python OOP
In-Depth Python OOP
Challenge: Admin
Swipe to show code editor
You have a User
class from the last challenge.
The methods are corrected (User
-> {self.username}
in strings).
Let's define the Admin
class!
- Define the
Admin
class inherited from theUser
class. - Define the
create_content()
admin's method that prints the string:
f"{self.username} creates the content"
. - Define the
update_content()
admin's method that prints the string:
f"{self.username} updates the content"
. - Define the
delete_content()
admin's method that prints the string:
f"{self.username} deletes the content"
.
Note
Admin
has all the capabilities ofUser
that do not need to be reimplemented. This is an example of how inheritance makes our life easier.
Дякуємо за ваш відгук!
Challenge: Admin
Swipe to show code editor
You have a User
class from the last challenge.
The methods are corrected (User
-> {self.username}
in strings).
Let's define the Admin
class!
- Define the
Admin
class inherited from theUser
class. - Define the
create_content()
admin's method that prints the string:
f"{self.username} creates the content"
. - Define the
update_content()
admin's method that prints the string:
f"{self.username} updates the content"
. - Define the
delete_content()
admin's method that prints the string:
f"{self.username} deletes the content"
.
Note
Admin
has all the capabilities ofUser
that do not need to be reimplemented. This is an example of how inheritance makes our life easier.
Дякуємо за ваш відгук!
Challenge: Admin
Swipe to show code editor
You have a User
class from the last challenge.
The methods are corrected (User
-> {self.username}
in strings).
Let's define the Admin
class!
- Define the
Admin
class inherited from theUser
class. - Define the
create_content()
admin's method that prints the string:
f"{self.username} creates the content"
. - Define the
update_content()
admin's method that prints the string:
f"{self.username} updates the content"
. - Define the
delete_content()
admin's method that prints the string:
f"{self.username} deletes the content"
.
Note
Admin
has all the capabilities ofUser
that do not need to be reimplemented. This is an example of how inheritance makes our life easier.
Дякуємо за ваш відгук!
Swipe to show code editor
You have a User
class from the last challenge.
The methods are corrected (User
-> {self.username}
in strings).
Let's define the Admin
class!
- Define the
Admin
class inherited from theUser
class. - Define the
create_content()
admin's method that prints the string:
f"{self.username} creates the content"
. - Define the
update_content()
admin's method that prints the string:
f"{self.username} updates the content"
. - Define the
delete_content()
admin's method that prints the string:
f"{self.username} deletes the content"
.
Note
Admin
has all the capabilities ofUser
that do not need to be reimplemented. This is an example of how inheritance makes our life easier.