-
Notifications
You must be signed in to change notification settings - Fork 0
/
SolidityFunctions.sol
57 lines (43 loc) · 1.08 KB
/
SolidityFunctions.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.8.2 <0.9.0;
contract MyFunctions
{
uint square;
uint cude;
//function Syntax
/*function <NAME>(args,args,args) <SCOPE> returns(DATATYPE)
{
return;
}*/
function getMyAddress() view public returns (address )
{
return msg.sender;
}
//private
function getSquare(uint _value) pure private returns(uint) {
uint result = _value * _value;
return result;
}
function getResult() external returns (uint)
{
square = getSquare(5);
return square;
}
function getCube(uint _value) pure internal returns(uint)
{
uint result = _value * _value * _value;
return result;
}
}
// D-Class B-Class
contract MyNewContract is MyFunctions
{
function checkAccessMode() public returns (uint)
{
cude = getCube(5);
return cude;
}
/* function callFromBaseContract() public returns (uint) {
return getResult();
}*/
}