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.
| File testF1.tol, 743 bytes (added by Pedro Gea, 15 years ago) |
|
|
| Line | |
|---|
| 1 | |
|---|
| 2 | Class @B; |
|---|
| 3 | |
|---|
| 4 | Class @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 | |
|---|
| 22 | Class @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 | |
|---|
| 32 | Real b::Delete(?); |
|---|
| 33 | |
|---|
| 34 | |
|---|
| 35 | |
|---|
Download in other formats: