Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # super and object keyword.py
- """ shows use of super and object keyword in python to initialise Parent class method """
- # Parent class
- class Person(object):
- def __init__(self,name):
- self.name = name
- # Child class
- class Employee(Person):
- def __init__(self,name,salary):
- # call Parent class method
- super(Employee,self).__init__(name)
- self.salary = salary
- gaurav = Employee("Gaurav",500)
- print gaurav.name
- print gaurav.salary
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement