// SPDX-License-Identifier:GPL-30
pragma solidity >= 0.7.0 < 0.9.0;
contract Father{
}
contract Son{
}
contract Father{
string public familyName = "Kim";
string public givenName = "Jung";
uint256 public money = 100;
function getFamilyName() view public returns(string memory){
return familyName;
}
function getGivenName() view public returns(string memory){
return givenName;
}
function getMoney() view public returns(uint256){
return money;
}
}
// 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;
function getFamilyName() view public returns(string memory){
return familyName;
}
function getGivenName() view public returns(string memory){
return givenName;
}
function getMoney() view public returns(uint256){
return money;
}
}
contract Son is Father{
}
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 returns(uint256){
return money;
}
}
// 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 returns(uint256){
return money;
}
}
contract Son is Father("James"){
}
솔리디티 강좌 12강 상속3 - 두개 이상 상속하기 (0) | 2021.09.08 |
---|---|
솔리디티 강좌 11강 상속 - overriding 오버라이딩 (0) | 2021.09.06 |
솔리디티 강좌 9강 instance2 - constructor (0) | 2021.09.04 |
솔리디티 강좌 8강 instance 1 - 정의 (2) | 2021.09.03 |
솔리디티 강좌 7강 function 4 - String (0) | 2021.09.02 |