Public | Internal | External | Private Functions II in Solidity

Source : https://solidity-by-example.org/visibility/

This is my short code

CODE

0-Deploy the Base Contract

1- We cant see private and internal functions directly.

2- We can see external and public functions.

How could we see other functions ? We need getter functions for both of them .

Getters

3- We click test functions.Yes.

4-Could we reach the external function with getter functions in the Base contract? NO

The following code cant work

function testExternalFunc() public pure returns (string memory) {

return externalFunc();

5- How could we see external function result from external contract ?

This is my code

contract Sample {

Base samplebase=new Base();

function reach() public view returns(string memory) {

return samplebase.externalFunc();

}

}

6- Deploy the Sample Contract

This is visibility business!

#ispanyolca

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store