On Open Zeppelin's ERC20 BasicToken contract the variable totalSupply_ follows a naming convention I haven't seen before.

Is that to differentiate it from the function totalSupply() below or is there another reason?


Yes that is precisely why.

If totalSupply_ was named totalSupply it would clash with the function totalSupply() and you would get the following error message:

DeclarationError: Identifier already declared.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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