You are on page 1of 1

class Person( object ):

# __init__ is known as the constructor


def __init__(self, name, roll):
self.name = name
self.roll = roll
def display(self):
print(self.name)
print(self.roll)

# child class
class student( Person ):
def __init__(self, name, roll, skikll,address):
self.skill=skull
self.address=address

# invoking the __init__ of the parent class


Person.__init__(self, name, roll)

# creation of an object variable or an instance


a = Person('Rahul', 886012)

# calling a function of the class Person using its instance


a.display()

You might also like