forked from D-One0914/BreakingSolidityBasic
-
Notifications
You must be signed in to change notification settings - Fork 4
/
lec11.sol
42 lines (28 loc) · 858 Bytes
/
lec11.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// SPDX-License-Identifier:GPL-30
pragma solidity >= 0.7.0 < 0.9.0;
contract Father{
string public familyName = "Kim";
string public givenName = "Jung";
uint256 public money = 100;
constructor(string memory _givenName) public {
givenName = _givenName;
}
function getFamilyName() view public returns(string memory){
return familyName;
}
function getGivenName() view public returns(string memory){
return givenName;
}
function getMoney() view public virtual returns(uint256){
return money;
}
}
contract Son is Father("James"){
uint256 public earning = 0;
function work() public {
earning += 100;
}
function getMoney() view public override returns(uint256){
return money+earning;
}
}