-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinheritance
More file actions
46 lines (31 loc) · 851 Bytes
/
Copy pathinheritance
File metadata and controls
46 lines (31 loc) · 851 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
43
44
45
# class Employee:
# company = "ITC" #base/parent class
# def show(self):
# print(f"The name of the employee is {self.name} and the salary is {self.salary}")
# class Programmer:
# company = "ITC Infotech" #child/inherited class
# def showLanguage(Employee):
# print(f"The name is {self.name} and the language is {self.language}")
# a = Employee()
# b = Programmer()
# print(a.company, b.company)
class Employee:
a = 1
class Programmer(Employee):
b = 2
class Manager(Programmer):
c = 3
@property
def name(self):
return self.name
@name.setter
def name(self, value):
self.name = value
o = Employee()
print(o.a)
o = Programmer()
print(o.a, o.b)
o = Manager()
print(o.a, o.b, o.c)
name = "harry"
print(f"Name is {self.name} and value is {self.value}")