Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Inheritance in solidity
1. + 9 1 9 5 0 1 7 0 7 7 4 1 T U T O R I A L S D I A R Y
S O L I D I T Y
I N H E R I T A N C E
2. + 9 1 9 5 0 1 7 0 7 7 4 1 T U T O R I A L S D I A R Y
confidential @Tutorials Diary | www.tutorialsdiary.com
What it is ?
What is inheritance
in solidity ?
3. + 9 1 9 5 0 1 7 0 7 7 4 1 T U T O R I A L S D I A R Y
confidential @Tutorials Diary | www.tutorialsdiary.com
Inheritance
Solidity does supports inheritance as other programming languages.
pragma solidity ^0.4.0;
contract member{
string name;
function setName(string _name){
name=_name;
}
}
contract teacher is member{
function getName() public returns(string){
return name;
}
}
4. + 9 1 9 5 0 1 7 0 7 7 4 1 T U T O R I A L S D I A R Y
confidential @Tutorials Diary | www.tutorialsdiary.com
Facts
If a contract inherit multiple contracts, all of the code from parent contract get copied and
single contract gets deployed on blockchain.
Internal keyword is used when we want to only allow access of variables in inherited contract.
Private keyword does not allow variables to accessed in inherited contract.