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 | 29 | 30 | 31 |
Tags
- solidity
- blockchain
- API
- built in object
- 삶
- node.js
- bitcoin
- graphQL
- web
- error
- express.js
- 기준
- Props
- evm
- CLASS
- SSR
- concept
- tailwindcss
- nextJS
- Interface
- Redux
- useState
- HTML
- CSS
- middleware
- JavaScript
- Ethereum
- hardhat
- REACT
- typeScript
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