250x250
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- built in object
- typeScript
- HTML
- Interface
- express.js
- web
- middleware
- error
- API
- useState
- bitcoin
- REACT
- graphQL
- CSS
- 기준
- node.js
- concept
- hardhat
- Props
- solidity
- nextJS
- blockchain
- 삶
- CLASS
- evm
- tailwindcss
- SSR
- Redux
- Ethereum
- JavaScript
Archives
- Today
- Total
ReasonJun
Solidity: Encapsulation 본문
728x90
// SPDX-License-Identifier: MIT
pragma solidity >= 0.7.0 < 0.9.0;
contract Number {
uint private num = 4;
function changeNum() public {
num = 5;
}
function getNum() public view returns (uint) {
return num;
}
}
contract Caller {
Number internal instance = new Number();
function changeNumber() public {
instance.changeNum();
}
function getNumber() public view returns(uint) {
return instance.getNum();
}
}
728x90
'Blockchain > Solidity' 카테고리의 다른 글
Solidity : Overriding (virtual / override / super) (0) | 2023.10.17 |
---|---|
Solidity : Overloading (1) | 2023.10.16 |
Solidity : Inheritance (is, override / Multiple) (0) | 2023.10.16 |
Solidity : Immutable / Constant (0) | 2023.10.16 |
Solidity : constructor (0) | 2023.10.16 |
Comments