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 #723: ticket_3.ClassConstructors.tol

File ticket_3.ClassConstructors.tol, 746 bytes (added by pgea@…, 16 years ago)
Line 
1//////////////////////////////////////////////////////////////////////////////
2// Creación clases
3// ¿Podrían incluirse los constructores en la definición de la clase?
4
5Class CPrueba {
6  Real _.valor;
7  Real GetValor(Real unused) { Copy(_.valor) };
8  Real SetValor(Real val) { Real _.valor := val }
9};
10
11CPrueba CPrueba.New(Real val) {
12  CPrueba newPrueba = [[ Real _.valor = val ]]
13};
14
15CPrueba CPrueba.Random(Real unused) {
16  CPrueba newPrueba = [[ Real _.valor = Rand(0,1) ]]
17};
18
19CPrueba a = CPrueba.New(0.2);
20CPrueba b = CPrueba.Random(?);
21
22// ¿Y hacer algo así?
23/*
24CPrueba a = CPrueba::New(0.2);
25CPrueba b = CPrueba::Random(?);
26*/
27
28//////////////////////////////////////////////////////////////////////////////
29