Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- class Circle:
- def __init__(self, radius):
- self.__radius = radius
- def getRadius(self):
- return self.__radius
- def setRadius(self, radius):
- self.__radius = radius
- def area(self):
- return math.pi * self.__radius ** 2
- def __add__(self, another_circle):
- return Circle( self.__radius + another_circle.__radius )
- class rec(Circle):
- def __init__(self,radius, diamtr):
- super().__init__(radius)
- self.__diamtr = diamtr
- def getdiamtr(self):
- return self.__diamtr * self.getRadius()
- c = rec(6,9)
- print(c.getdiamtr())
- print(c.getRadius())
Add Comment
Please, Sign In to add comment