Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Abstract contract 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
A B S T R A C T C O N T R A C T
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 abstract
contract 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
Abstract Contract
Contracts are knows as abstract when one of the function in that contract lacks
implementation.
pragma solidity ^0.4.0;
contract member{
string name;
function setName() public returns (string);
}
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
Abstract Contract
Another contract can inherit abstract contract and implement the function.
pragma solidity ^0.4.0;
contract member{
string name;
function setName() public returns (string);
}
contract teacher is member{
function setName() public returns(string){
return "Mark";
}
}
5. + 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
Abstract functions can't be complied
If a contract inherits from an abstract contract and does not implement all non-implemented
functions by overriding, it will itself be abstract