mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Implement virtual keyword
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
contract BaseBase {
|
||||
uint public x;
|
||||
uint public y;
|
||||
function init(uint a, uint b) public {
|
||||
function init(uint a, uint b) public virtual {
|
||||
x = b;
|
||||
y = a;
|
||||
}
|
||||
function init(uint a) public {
|
||||
function init(uint a) public virtual {
|
||||
x = a + 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ contract X {
|
||||
function f() public returns (uint x) {
|
||||
x = g();
|
||||
}
|
||||
function g() public returns (uint x) {
|
||||
function g() public virtual returns (uint x) {
|
||||
x = 2;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user