-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMultiple_Inheritance.py
More file actions
35 lines (34 loc) · 948 Bytes
/
Copy pathMultiple_Inheritance.py
File metadata and controls
35 lines (34 loc) · 948 Bytes
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 Human:
def __init__(self,heart):
print("calling init function from Human")
self.num_eyes=2
self.num_nose=1
self.num_heart=heart;
def eat(self):
print("I can eat")
def work(self):
print("I can work")
class Male:
def __init__(self,name):
print("Calling init from male")
self.name=name
def flirt(self):
print("I flirt a lot")
def work(self):
print("I can code")
class Boy(Human,Male):
def __init__(self,name,heart,language):
Human.__init__(self,heart)
Male.__init__(self,name)
self.language=language;
def sleep(self):
print("I can sleep")
def work(self):
print("I can test")
def display(self):
print(f"Hii I am {self.name} and I work on {self.language}")
boy_1=Boy("Rahul",1,"python")
print(boy_1.num_nose)
print(boy_1.num_heart)
print(boy_1.language)
print(boy_1.display())