Questions tagged [inheritance]

Inheritance in this stackexchange refers to parent child contract relationship where the child contract is considered to be a type of the parent contract and hence implement the parent contract functions. This is same like inheritance in OOP in generic programming except for the fact that in this community its used in a contract oriented programming domain.

Filter by
Sorted by
Tagged with
25
votes
2answers
9k views

'internal' keyword in a function definition in Solidity

Does the internal keyword in a function definition such as: function doSomeThing(uint _param) internal {...} work similar to designating a method as private in other languages and thus makes the ...
9
votes
2answers
927 views

Solidity and multiple inheritance

I'm attempting to understand how solidity resolves multiple inheritance. As explained in the docs, Solidity uses C3 linearization. The relation between my classes is displayed on the image below: I ...
6
votes
2answers
3k views

Multiple Inheritance and Linearization

Hello to everyone. I am looking at multiple inheritance in Solidity. I came across this example within their documentation, but it is not understandable enought for me. Can someone explane this ...
4
votes
1answer
768 views

solc returns empty bin for contracts with constructor and inheritance

Having a simple contract structure like this: pragma solidity ^0.4.8; contract A { uint public a1; } contract B is A { uint8 public b1; } I can compile it with: > solc --combined-json "abi,...
1
vote
1answer
46 views

Solidity Syntax question

What happens if a function is being passed before { into another function? Like DetailedERC20(_name, _symbol, TOKEN_DECIMALS) in this example: function MyToken(Registry _registry, string _name, ...
4
votes
3answers
4k views

Interface Function

I understand that the following function is used to link the ico contract to the token. Appreciate if someone could explain how to use the function, and exactly how it works. Thank you. /** * @title ...
14
votes
1answer
4k views

Inheritance and Function Overwriting: Who can call the parent function?

I want to know who is still able to call an original overwritten function in case of inheritance. Let's assume I have the following setup: contract A{ address public owner; function A(){ ...
9
votes
2answers
3k views

Constructors of inherited contracts in Solidity

Given: contract A { address owner; function A() { owner = msg.sender; } } contract B is A { string greeting; function B(string _greeting) { greeting = _greeting; } } When I ...
1
vote
1answer
43 views

Value of msg.sender in call to inherited external function

I found this in the official solidity docs. The values of all members of msg, including msg.sender and msg.value can change for every external function call. This includes calls to library ...
1
vote
2answers
171 views

Solidity, is it possible to deploy a smart contract that prevents other smart contracts from inheriting from it?

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 ...
0
votes
1answer
205 views

Solidity smart contract inherited function output failed

I'm trying to inherit a function from the parent contract into child contract and its working fine in remix JavaScript VM. I did the following steps: Deployed the parent contract in remix JavaScript ...