-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprograma.txt
72 lines (57 loc) · 1.33 KB
/
programa.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
{
classe Contador0 {
int valor = 1;
proc print() {
write(this.valor)
},
proc incrementa() {
this.print();
this.valor := this.valor + 1
}
},
classe Contador {
Contador0 c2 := new Contador0,
int valor = 1;
proc print() {
write(this.valor)
},
proc incrementa() {
this.print();
this.valor := this.valor + 1
}
},
classe Contador2 {
Contador c3 :=new Contador,
int valor = 1;
proc incrementa() {
this.valor := this.valor + 1
},
proc print() {
write(((this).c3).valor);
(this.c3).c2.incrementa();
write("VAI IMPRIMIR THIS.C3.C2 QUE EH 2");
write(((this.c3).c2).valor)
}
}
;
{
Contador c := new Contador,
int d = 8, int x = 3,
Contador2 c2 := new Contador2;
write("Will read d");
read(d);
c.valor :=4;
write("D eh "++ d);
write("Will read x");
read(x);
write("X eh "++ x);
//c.incrementa();
//c2.incrementa();
//c2.incrementa();
write("VAI IMPRIMIR C2.C");
(c2).c3.print();
write("vai imprimir C:"++c.valor);
c.print();
c2.print()
}
}