Guest User

Untitled

a guest
May 5th, 2016
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. import math
  2.  
  3. class Circle:
  4.  
  5. def __init__(self, radius):
  6. self.__radius = radius
  7.  
  8. def getRadius(self):
  9. return self.__radius
  10.  
  11. def setRadius(self, radius):
  12. self.__radius = radius
  13.  
  14. def area(self):
  15. return math.pi * self.__radius ** 2
  16.  
  17. def __add__(self, another_circle):
  18. return Circle( self.__radius + another_circle.__radius )
  19.  
  20. class rec(Circle):
  21.  
  22. def __init__(self,radius, diamtr):
  23. super().__init__(radius)
  24. self.__diamtr = diamtr
  25.  
  26. def getdiamtr(self):
  27. return self.__diamtr * self.getRadius()
  28.  
  29.  
  30. c = rec(6,9)
  31. print(c.getdiamtr())
  32. print(c.getRadius())
Add Comment
Please, Sign In to add comment