-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAlphabet.sol
59 lines (48 loc) · 1.05 KB
/
Alphabet.sol
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
pragma solidity ^0.4.0;
interface Letter {
function n() public returns (uint);
}
contract A is Letter {
function n()
public
returns (uint) {
return 1;
}
}
contract B is A {}
contract C is Letter {
function n()
public
returns (uint) {
return 2;
}
function x()
public
returns (string) {
return "x";
}
}
contract Alphabet {
Letter[] private letters;
event Printer(uint);
function Alphabet()
public {
letters.push(new A());
letters.push(new B());
letters.push(new C());
}
function loadRemote(address _addrX,
address _addrY,
address _addrZ)
public {
letters.push(Letter(_addrX));
letters.push(Letter(_addrY));
letters.push(Letter(_addrZ));
}
function printLetters()
public {
for(uint i = 0; i < letters.length; i++) {
Printer(letters[i].n());
}
}
}