0

If I have a contract that consist of a mapping and I want to interact with this mapping in another contract, which is inheriting the previous contract.

  • Should I then make sure to mark the mapping as 'internal' or don't give it any visibility at all?

I often see following mapping being inherited and interacted with by another contract but it never has any visibility specified.

mapping(address => uint256) balances;

Shouldn't it be

mapping(address => uint256) internal balances;

Thanks!

1

Both are equivalent, since internal is the default. From https://solidity.readthedocs.io/en/develop/contracts.html#visibility-and-getters:

For state variables, external is not possible and the default is internal.

  • thanks I thought state variables were private by default! – NowsyMe Jan 23 '18 at 17:28
  • what would you recommend for someone to get in-depth with blockchain dev from scratch? Is there a way I can contact you and receive 5minutes of your time for some advice/questions ? I'll pay for your time if necessary. Thanks – NowsyMe Jan 23 '18 at 20:49
  • I would definitely recommend my blog: programtheblockchain.com. :-) We're just getting off the ground, but we're trying to take a from-scratch approach and are just now building up to more realistic applications. Definitely let us know if you have suggestions for topics we should write about. – smarx Jan 23 '18 at 22:14
  • Could you write about the process of designing a blockchain system? the various layers, I think it's interesting how the technology evolves..I'd like to study those designs closer as well, but don't really know which type of books to search for, I'm assuming distributed system designs of some sort. Thanks – NowsyMe Jan 25 '18 at 3:12

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.