tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 deletions
14
Task/Polymorphism/Python/polymorphism-2.py
Normal file
14
Task/Polymorphism/Python/polymorphism-2.py
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
class Point(object):
|
||||
def __init__(self, x=0.0, y=0.0):
|
||||
self.x = x
|
||||
self.y = y
|
||||
def __repr__(self):
|
||||
return '<Point 0x%x x: %f y: %f>' % (id(self), self.x, self.y)
|
||||
|
||||
class Circle(Point):
|
||||
def __init__(self, x=0.0, y=0.0, radius=1.0):
|
||||
Point.__init__(self, x, y)
|
||||
self.radius = radius
|
||||
def __repr__(self):
|
||||
return '<Circle 0x%x x: %f y: %f radius: %f>' % (
|
||||
id(self), self.x, self.y, self.radius)
|
||||
Loading…
Add table
Add a link
Reference in a new issue