23 - Function Visibility
Function Visibility Specifiers: Functions have to be specified as being public
, external
, internal
or private
:
-
public
: Public functions are part of the contract interface and can be either called internally or via messages. -
external
: External functions are part of the contract interface, which means they can be called from other contracts and via transactions. An external function f cannot be called internally (i.e.f()
does not work, butthis.f()
works). -
internal
: Internal functions can only be accessed internally from within the current contract or contracts deriving from it -
private
: Private functions can only be accessed from the contract they are defined in and not even in derived contracts
- Function Visibility
public
external
internal
private
public
/external
: Interfaceexternal
: Not Internallyinternal
: Base/Derivedprivate
: Contract- Visibility: Access Control
- Security Implications