You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# A class is like a blueprint for creating objects. An object has properties and methods(functions) associated with it. Almost everything in Python is an object
# Create class
classUser:
# Constructor
def__init__(self, name, email, age):
self.name=name
self.email=email
self.age=age
defgreeting(self):
returnf'My name is {self.name} and I am {self.age}'
defhas_birthday(self):
self.age+=1
# Extend class
classCustomer(User):
# Constructor
def__init__(self, name, email, age):
self.name=name
self.email=email
self.age=age
self.balance=0
defset_balance(self, balance):
self.balance=balance
defgreeting(self):
returnf'My name is {self.name} and I am {self.age} and my balance is {self.balance}'