Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Superclass
- class Store( ):
- def __init__(self):
- self.owner = "Boris"
- def exclaim(self):
- return "I'm defined in the superclass!"
- #Subclass of Store
- class HardwareStore(Store): #Inheriting from Store SuperClass
- pass
- home_depot = HardwareStore( ) #Instantiating an instance
- print(home_depot.owner) #Accessing the "owner" attribute
- print(home_depot.exclaim( )) # Invoking the exclaim instance method
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement