Contenuti del Corso
In-Depth Python OOP
In-Depth Python OOP
4. Polymorphism and Abstraction
Challenge: AuthMixin
Compito
Swipe to start coding
Let's make your code more flexible.
- Define the
AuthMixin
class. - Cut the
login
andlogout
methods from theUser
class and insert them into theAuthMixin
body. - Move the
is_authenticated
class attribute to theAuthMixin
. - Inherit the
User
class from theAuthMixin
.
Note
After performing all the actions, you will have an authorization mixin (
AuthMixin
) that can be used for different user classes.
Soluzione
Tutto è chiaro?
Grazie per i tuoi commenti!
Sezione 4. Capitolo 3
Challenge: AuthMixin
Compito
Swipe to start coding
Let's make your code more flexible.
- Define the
AuthMixin
class. - Cut the
login
andlogout
methods from theUser
class and insert them into theAuthMixin
body. - Move the
is_authenticated
class attribute to theAuthMixin
. - Inherit the
User
class from theAuthMixin
.
Note
After performing all the actions, you will have an authorization mixin (
AuthMixin
) that can be used for different user classes.
Soluzione
Tutto è chiaro?
Grazie per i tuoi commenti!
Sezione 4. Capitolo 3