Skip to content

Type Error for Storage Factory's sfGet method. #20

Answered by conqryash007
TilakMaddy asked this question in Q&A
Discussion options

You must be logged in to vote

Just replace simpleStorageArray[_simpleStorageIndex].number; with simpleStorageArray[_simpleStorageIndex].number(); in sfGet function.
The code will compile correctly.

function sfGet(uint256 _simpleStorageIndex) public view returns(uint256) {
        return simpleStorageArray[_simpleStorageIndex].number();
    }

Solidity generates a getter function for every public variable which is used to access its content.

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@PatrickAlphaC
Comment options

@TilakMaddy
Comment options

@conqryash007
Comment options

@TilakMaddy
Comment options

Answer selected by PatrickAlphaC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants