-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoop_base_part2.py
More file actions
53 lines (40 loc) · 1.42 KB
/
Copy pathoop_base_part2.py
File metadata and controls
53 lines (40 loc) · 1.42 KB
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
46
47
48
49
50
51
52
53
#!/usr/bin/python -tt
'sd;kvngfidsvbofdmbp'
import sys
import time
import abc
class Employee:
__metaclass__ = abc.ABCMeta
def __init__(self):
print ('entering the default constructor of the base class')
@abc.abstractmethod
def calculateSomething(self, a, b):
print('Entering the calculateSomething method in the base class')
class BlueBadgeEmployee(Employee,object):
def __init__(self):
super(BlueBadgeEmployee, self).__init__()
print('entering the default constructor of the BlueBadgeEmployee child class')
def calculateSomething(self, a, b):
self.a = a
self.b = b
super(BlueBadgeEmployee, self).calculateSomething(a,b)
print('entering the calculateSomething method of the BlueBadgeEmployee child class')
print('Here we do addition')
return (a+b)
class GreenBadgeEmployee(Employee):
def __init__(self):
print('entering the default constructor of the GreenBadgeEmployee child class')
def calculateSomething(self, a, b):
print('entering the calculateSomething method of the GreenBadgeEmployee child class')
print('Here we do multiplication')
return (a*b)
# Define a main() function that prints a little greeting.
def main():
# Get the name from the command line, using 'World' as a fallback.
emp = Employee()
#emp.calculateSomething()
emp = BlueBadgeEmployee()
emp.calculateSomething(2,3)
# This is the standard boilerplate that calls the main() function.
if __name__ == '__main__':
main()