fork download
  1. class CalMultiply():
  2. def multiply(self):
  3. return self.v1*self.v2
  4. class CalDivide():
  5. def divide(self):
  6. return self.v1/self.v2
  7. class Cal(CalMultiply, CalDivide):
  8. def __init__(self, v1, v2):
  9. if isinstance(v1, int):
  10. self.v1 = v1
  11. if isinstance(v2, int):
  12. self.v2 = v2
  13. def add(self):
  14. return self.v1+self.v2
  15. def subtract(self):
  16. return self.v1-self.v2
  17. def setV1(self, v):
  18. if isinstance(v, int):
  19. self.v1 = v
  20. def getV1(self):
  21. return self.v1
  22. c = Cal(100, 10)
  23. print(c.add())
  24. print(c.multiply())
  25. print(c.divide())
  26.  
Success #stdin #stdout 0.02s 9984KB
stdin
Standard input is empty
stdout
110
1000
10.0