address public owner;

Also, if we don't make a variable public manually, what is the default, private?

1 Answer 1


See https://programtheblockchain.com/posts/2018/01/02/making-smart-contracts-with-public-variables/ for a full explanation.

Yes, the default visibility for state variables is internal(as per v0.8.4). Marking it public makes it easy to read the variable in a DApp or from another smart contract.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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