public function that returns a private variable?
reading doesn't cost gas
probably no difference, variable access probably always ends up being a simple PUSH some_addr; SLOAD; Public variables actually just end up creating public getter functions for you. You still need to do stuff like, otherContract.getPublicVar(); You cannot just access it like: myLocalVar = otherContract.getPublicVar; So in the end, in solidity, you end up with the same thing, a public function accessing a data member. I would imagine solidity compiler inlines these functions as simple PUSH/SLOAD operations.
Reading costs gas, but you don't pay for it. The question was about contract deployment.
Обсуждают сегодня