Given:
contract A {
address owner;
function A() { owner = msg.sender; }
}
contract B is A {
string greeting;
function B(string _greeting) { greeting = _greeting; }
}
- When I deploy my contract, I want to make sure that
owner
is initialized. Do I need to call the parent constructor inB
's constructor to initialize the valueowner
inA
like so:function B (string _greeting) A(msg.sender) { greeting = _greeting; }
, or can I just leave it as is above (it will initialize the values ofA
automatically, by automatically callingA()
? - Does
B
need its own address, or will it just useA
's as its own?