Goodmorning. I've starting using Eiffel at the University.
I have this example:
class
CLASS_1
create make
feature
x: INTEGER
make
do
x:=0
end
increment(inc: INTEGER)
do
x:=x+inc
end
get_x: INTEGER
do
Result:=x
end
end
----------------
class
CLASS_2
create make_2
feature
make_2
do
print("EXAMPLE")
meth_1
end
meth_1
local
instance: CLASS_1
i: INTEGER
do
create instance.make
from
i:=0
until
i<20
loop
instance.increment(5)
end
io.put_string ("The result is: ")
io.put_integer (instance.get_x)
end
end
Why the result is always 0? It seems like it doesn't update the value. I've read that the client class attributes are read-only. Is it true?