区块链 – 内部/外部和公共/私人功能之间的区别是什么?

目前阅读可靠性文档:
https://solidity.readthedocs.io/en/develop/types.html#function-types

By default, function types are internal, so the internal keyword can
be omitted. In contrast, contract functions themselves are public by
default, only when used as the name of a type, the default is
internal.

这对我来说没有意义.一个功能如何同时内部和公共?

我知道内部意味着函数只能在合约中调用,而外部函数可以在合约之外调用.所以对我来说,内部是私有的,外部是公共的,但文档使它听起来像是公共和内部同时?

那么内部/外部和公共/私人在功能方面有什么区别呢?

最佳答案
在Solidity术语中,internal / external也使用描述’两种函数调用’而不仅仅作为访问修饰符.

Take a look at the documentation section about ‘Visibility and Getters’ inside the contracts.

Since Solidity knows two kinds of function calls (internal ones that do not create an actual EVM call (also called a “message call”) and external ones that do), there are four types of visibilities for functions and state variables.

转载注明原文:区块链 – 内部/外部和公共/私人功能之间的区别是什么? - 代码日志