aak*_*dev 7 blockchain ethereum solidity smartcontracts decentralized-applications
我正在学习 Solidity,并且知道interface
和abstract
都是可能包含未使用的函数的类。我的疑问是: Solidity 智能合约interface
和Solidity 智能合约有什么区别?abstract contract
它与大多数其他面向对象的编程语言相同:
例子:
interface IMyContract {
// can declare, cannot implement
function foo() external returns (bool);
}
Run Code Online (Sandbox Code Playgroud)
abstract contract MyContract {
// can declare
function foo() virtual external returns (bool);
// can implement
function hello() external pure returns (uint8) {
return 1;
}
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
2370 次 |
最近记录: |