Add initial methods
This commit is contained in:
parent
d1567735ab
commit
55a6b0c282
1 changed files with 19 additions and 2 deletions
|
|
@ -1,4 +1,21 @@
|
|||
from points import Point
|
||||
|
||||
a = Point(5, 6)
|
||||
print(a)
|
||||
class Rectangle:
|
||||
def __init__(self, pos, width, height):
|
||||
self.pos = pos
|
||||
self.width = width
|
||||
self.height = height
|
||||
|
||||
def getWidth(self):
|
||||
return self.width
|
||||
|
||||
def getHeight(self):
|
||||
return self.height
|
||||
|
||||
def __str__(self):
|
||||
return "Lower Left Coordinates: {}; Width: {}; Height: {}".format(self.pos, self.width, self.height)
|
||||
|
||||
|
||||
r = Rectangle(Point(4, 5), 6, 5)
|
||||
print(r)
|
||||
|
||||
Loading…
Reference in a new issue