I have the following Solidity contract:
pragma solidity ^0.7.4;
contract Parent
{
uint public number;
}
contract Child is Parent
{
function setParentNumber(uint _number) public {
number = _number;
}
}
So when I deploy Child
, I'm able to modify the Parent
's property number
. So far so good.
Question: Is is possible to extend an already deployed contract and access its public properties?
Example:
Parent
has been deployed separately to address0x123456
and its propertynumber
now has value of5
.- Now I want to deploy Child to a separate address, but I want to be able to set the
Parent
's (on address0x123456
) propertynumber