Skip to content

Instantly share code, notes, and snippets.

@zefirka
Created July 10, 2016 13:54
Show Gist options
  • Save zefirka/7d69dbdfb637b3c71968674bbe32cdd6 to your computer and use it in GitHub Desktop.
Save zefirka/7d69dbdfb637b3c71968674bbe32cdd6 to your computer and use it in GitHub Desktop.
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