-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPython_oops_7.py
More file actions
42 lines (30 loc) · 997 Bytes
/
Python_oops_7.py
File metadata and controls
42 lines (30 loc) · 997 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
36
37
38
39
40
41
42
# Multiple Inheritence
class Employee:
no_of_leave = 8
def __init__(self, aname, asalary, arole):
self.name = aname
self.salary = asalary
self.role = arole
def printdetails(self):
return f"The Name is {self.name}, salary is {self.salary} and role is {self.role}"
@classmethod
def change_leaves(cls, newleaves):
cls.no_of_leave = newleaves
class Player:
var = 9
no_of_games = 4
def __init__(self, name, game):
self.name = name
self.game = game
def printdetails(self):
return f'The Name is {self.name} and game is {self.game}'
class CoolProgrammer(Player, Employee):
language = "C++"
def printlanguage(self):
print(self.language)
nikhil = Employee("Nikhil", 40000, "Instructor")
tarun = Employee("Tarun", 80000, "Student")
vishal = CoolProgrammer("Vishal", "Cricket")
det = vishal.printdetails()
print(vishal.printlanguage())
print(det)