-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathoop3.py
37 lines (24 loc) · 812 Bytes
/
oop3.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
class Person: #class
Name = ''# class variable
Age = 0
def __init__(self, Name, Age): #construct
self.Name = Name #instance variable attri
self.Age = Age
def GetName(self): #methods
print(self.Name)
def GetAge(self):
print(self.Age)
class Student: #class
Id = '' #class variable
def __init__(self, Id): #construct
self.Id = Id #instance variable
def GetId(self): #methods
print(self.Id)
class Resident(Person, Student): #multiple inheritence
def __init__(self, Name, Age, Id):
Person.__init__(self, Name, Age)
Student.__init__(self, Id)
resident1 = Resident('Rashmin', 22, '2') #class instance or object of an instance
resident1.GetName()#ouput
resident1.GetAge()
resident1.GetId()