nitlanguage
/
nit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
lib/mnit: expand images to the nearest power of 2 for OpenGL ES 1.0
[nit.git]
/
tests
/
example_point.nit
diff --git
a/tests/example_point.nit
b/tests/example_point.nit
index
c2363c2
..
a7b89ea
100644
(file)
--- a/
tests/example_point.nit
+++ b/
tests/example_point.nit
@@
-16,56
+16,28
@@
class Point
private
class Point
private
- attr _x: Int # Abscisse
- attr _y: Int # Ordonnée
-
-
- meth x: Int
- do
- return _x
- end
- meth x=(i: Int)
- do
- _x = i
- end
-
- meth y: Int
- do
- return _y
- end
- meth y=(i: Int)
- do
- _y = i
- end
+ var x: Int = 0 # Abscisse
+ var y: Int = 0 # Ordonnée
# Change la position d'un point
# Change la position d'un point
- meth moveto(x: Int, y: Int)
+ fun moveto(x: Int, y: Int)
do
_x = x
_y = y
end
do
_x = x
_y = y
end
- redef meth to_s: String
+ redef fun to_s: String
do
do
- var s = "("
- s.append(_x.to_s)
- s.add(':')
- s.append(_y.to_s)
- s.add(')')
+ var s = "({_x}:{_y})"
return s
end
return s
end
- redef meth ==(p)
+ redef fun ==(p)
do
do
- return not p is null and p isa Point and _x == p.x and _y == p.y
+ return p isa Point and _x == p.x and _y == p.y
end
end
- init
- do
- moveto(0, 0)
- end
-
init at(x: Int, y: Int)
do
moveto(x, y)
init at(x: Int, y: Int)
do
moveto(x, y)