Am I able to manipulate preset variables inherited from imported OZ contracts?

Hello, I’m a bit of a novice with openzeppelin and Sol in general. I was wondering whether I am able to use variables pre-defined in the ERC20 contract within my (child) contract.

For example, I want to create a struct

struct Overview
uint256 _totalSupply;
uint256 _owner;

How do I access and manipulate these pre-defined variables? If I define them locally do they override what is already defined within the openzeppelin contract? I hope this is clear and understandable, I am not particularly experienced as you can probably tell. Really appreciate your time and help!

Hi, welcome! :wave:

I do not think you can manipulate these pre-defined variables, cause you can see, these variables are private, so you are not able to access them in your child contract, you can only use functions to access these variables.

I do not think so, these variables are private, you can not override them. You can have a look at the solidity documentation:

Thank you so much for the reply! I am familiar with these concepts, and for whatever reason assumed that inheritance interactions would be significantly different in this context. This makes way more sense now and your insight has made it significantly easier to digest and figure out similar cases that take a bit of initial thought to figure out. Appreciate it!

1 Like