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
| class Base:
| def __init__(self, a, b):
| self.a = a
| self.b = b
|
| def sum(self):
| return self.a + self.b
|
| def diff(self):
| return self.a - self.b
|
|
| class Derivate(Base):
| def product(self):
| return self.a * self.b
|
| class Derivate2(Base):
| def __init__(self, a, b , c):
| super().__init__(a, b)
| self.c = c
|
| def quote(self):
| return self.a / self.c
|
|
| class Common:
| def __init__(self, a, b):
| self.a, self.b = a,b
| def sum(self):
| return self.a + self.b
|
| def makeMath(x:Base):
| s = x.sum()
| print(s)
|
| t = Common(8,9)
| makeMath(t)
|
| x:Base = Base(1, 3)
| makeMath(x)
|
| y:Derivate = Derivate(3, 4)
| makeMath(y)
|
| z:Derivate2 = Derivate2(1, 2, 3)
| makeMath(y)
|
|