Visibility of function and state variable #20
AnandK-2024
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
External functions are part of the
contract interface
. Anexternal function f cannot be called internally
(i.e.f() does not work
, butthis.f()
works). External functions are sometimes more efficient when they receive large arrays of data. Forstate variables, external is not possible
.Public functions are part of the
contract interface and can be either called internally or via messages
. For public state variables, an automatic getter function (see below) is generated.Internal
functions and state variables can only be accessed internally
,without using this
.Private functions and state variables are only visible for the contract they are defined in and not in derived contracts.
external
may be sufficient instead ofpublic
Beta Was this translation helpful? Give feedback.
All reactions