Skip to content

Lesson 14: why do we need function _initializeContract() ? #2323

Answered by alymurtazamemon
ManuWeb3 asked this question in Q&A
Discussion options

You must be logged in to vote

@ManuWeb3 Hey! Your concern is correct, In the video, he has done the way you are saying it should be. But I think in the repo he has followed this approach for the tests. He has created a function for it that turns a public variable s_initialized to true after initializing so he can test it in the unit tests. Because otherwise, the array is internal he could not get it in the tests. Also another approach he can follow is that he can create a getter function for array that returns its length. But these all are approaches that differes from person to person.

Replies: 3 comments 8 replies

Comment options

You must be logged in to vote
2 replies
@ManuWeb3
Comment options

@RoboCrypter
Comment options

Comment options

You must be logged in to vote
5 replies
@ManuWeb3
Comment options

@krakxn
Comment options

@ManuWeb3
Comment options

@krakxn
Comment options

@ManuWeb3
Comment options

Comment options

You must be logged in to vote
1 reply
@ManuWeb3
Comment options

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