-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclasses.py
More file actions
51 lines (39 loc) · 957 Bytes
/
classes.py
File metadata and controls
51 lines (39 loc) · 957 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
class point:
#classe que representa pontos no plano cartesiano
def setx(self,coordx):
self.x = coordx
def sety(self,coordy):
self.y = coordy
def get(self):
return(self.x,self.y)
def move(self, dx, dy):
self.x += dx
self.y += dy
class color_point(point):
def xcolor(self,color):
self.colorx = color
def ycolor(self,color):
self.colory = color
def get_colors(self):
return(self.colorx,self.colory)
def getall(self):
return str(self.x) + ' - ' + self.colorx + ' / ' + str(self.y) + ' - ' + self.colory
a = point()
a.setx(3)
a.sety(4)
print(a.get())
a.move(3,4)
print(a.get())
b = point()
b.setx(6)
b.sety(8)
print(b.get())
b.move(-6,-2)
print(b.get())
c = color_point()
c.setx(1)
c.sety(2)
c.colorx = 'Azul'
c.colory = 'Vermelho'
print(c.get())
print(c.getall())