1

I am new to Ethereum and I was wondering if it is possible to deploy a smart contract such that other smart contracts are not able to inherit from it. In other words once a smart contract is deployed can other smart contracts inherit from it?

2

Smart contracts don't inherit from deployed smart contracts. Inheritance is a feature of the Solidity language, Solidity is compiled to EVM bytecode which is what is stored/deployed on the Ethereum blockchain.

When you inherit a contract in Solidity, the inherited contracts functionality is copied into the inheriting contract during the compilation process. The compiled bytecode is what is deployed to the Ethereum blockchain.

1

As per my understanding also what @willjgriff says is correct. i.e. When Inheriting they do not use other deployed contract but have that code in the same address.

However if you want a child contract not to use any member in the parent contract, you can make them private, so the child contract may need some other member of the parent class to access that private member (may be some validating function).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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