0

Suppose there is a 3 contracts:

contract A {
    uint num;
    constructor(uint num){
        num=num;
    }
}
contract B is A {
    string name;
    constructor(string memory _name, uint num)A(num){
        name = _name;
    }
}
contract C is B {
    address me;
     
     < constructor >
}

As we can see contract-C is inherits from contract-B which also inherits from contract-A, in this case how the constructor of contract-C will be structured? Will it be structured like this?

constructor(address _me, string memory _name, uint _num)B(_name)A(_num);

1 Answer 1

0

It should be

contract C is B {
    address me;
     
     constructor(address _me, string memory _name, uint _num)B(_name,_num);
}

Contract C, only has to instantiate only B.

Hope it helps!

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.