Created
July 10, 2016 13:54
-
-
Save zefirka/7d69dbdfb637b3c71968674bbe32cdd6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User: | |
rights = ['read'] | |
def __init__(self, name, age): | |
self.name = name | |
self.age = int(age) | |
def __str__(self): | |
return 'User: <name: {name}, age: {age}>'.format(name=self.name, age=self.age) | |
class Customer(User): | |
rights = ['read', 'buy'] | |
def __init__(self, name, age, products=[]): | |
super().__init__(name, age) | |
self.products = products | |
def buy(self, product): | |
self.products.append(product) | |
user1 = User('Mr. Bean', 43) | |
user2 = User('Dr. Hide', 66) | |
customer1 = Customer('JJ', 28) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment