close
Warning:
Can't synchronize with repository "(default)" (/var/svn/tolp does not appear to be a Subversion repository.). Look in the Trac log for more information.
Ticket #727: ticket_4.ClassReadOnlyMembers.tol
File ticket_4.ClassReadOnlyMembers.tol, 584 bytes (added by pgea@…, 16 years ago) |
|
Line | |
---|
1 | ////////////////////////////////////////////////////////////////////////////// |
---|
2 | // Creación clases |
---|
3 | // ¿Por qué se pueden redefinir los miembros sólo lectura? |
---|
4 | |
---|
5 | Class CPrueba { |
---|
6 | Real _.valor; |
---|
7 | Real GetValor(Real unused) { Copy(_.valor) }; |
---|
8 | Real SetValor(Real val) { Real _.valor := val } |
---|
9 | }; |
---|
10 | |
---|
11 | CPrueba CPrueba.New(Real val) { |
---|
12 | CPrueba newPrueba = [[ Real _.valor = val ]] |
---|
13 | }; |
---|
14 | |
---|
15 | CPrueba a = CPrueba.New(1); |
---|
16 | Real a::GetValor(?); //-> 1 |
---|
17 | Real a::_.valor := 0; |
---|
18 | Real a::GetValor(?); //-> 0 |
---|
19 | |
---|
20 | ////////////////////////////////////////////////////////////////////////////// |
---|
21 | |
---|
Download in other formats: