pragma solidity ^0.5.7;

    contract Test {
        function test() public view  returns (uint){
             return 10*10;

        function test2() external view  returns (uint){
             return 10*2;

1) according to my knowledge external means we cannot call the function inside class but how i am able to call it ?

Can any one please explain? This is my output which i can see in remix console.

 status     0x1 Transaction mined and execution succeed
 transaction hash   0x0e3c9b7c67387cdcf3a4d2001323e83b20f64dbe12abb6e81700ccc6cc844454
 from   0xca35b7d915458ef540ade6068dfe2f44e8fa733c
 to     Test.test2() 0x0dcd2f752394c41875e259e00bb44fd505297caf
 gas    3000000 gas

 transaction cost   21463 gas 
 execution cost     191 gas 
 hash   0x0e3c9b7c67387cdcf3a4d2001323e83b20f64dbe12abb6e81700ccc6cc844454
 input  0x66e...41cb7
 decoded input  {}
 decoded output     {
    "0": "uint256: 20"
 logs   []

0 wei

1 Answer 1


Sure you can: this.test2() instead of just test2. But notice that msg.sender will be changed to this.

public = internal + external

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.