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 #1116: testF1.tol

File testF1.tol, 743 bytes (added by Pedro Gea, 14 years ago)
Line 
1
2Class @B;
3
4Class @A {
5  Set childs = Copy(Empty);
6  NameBlock CreateChild(Real void) {
7    @B child = [[ Real data = 1 ]];
8    NameBlock _this2 = _this;
9    //Set Append(child::parent, [[_this]], 0); // ALTERNATIVA 1
10    Set Append(child::parent, [[_this2]], 0); // ALTERNATIVA 2
11    Set Append(childs, [[ child ]], True);
12    child
13  };
14  Real RemoveChild(Real index) {
15    NameBlock child = childs[index];
16    Set Remove(childs, index, 1);
17    NameBlock child := [[ Real null = 1 ]]; // se destruye
18    Real void = ?;
19  1}
20};
21   
22Class @B {
23  Real data;
24  Set parent = Copy(Empty);
25  Real Delete(Real void) { (parent[1])::RemoveChild(1) }
26};
27
28@A a;
29
30@B b = a::CreateChild(?);
31
32Real b::Delete(?);
33
34
35