-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Solidity Programming Essentials
By :
Interfaces are like abstract contracts, but there are differences. Interfaces cannot contain any definition. They can only contain function declarations. It means functions in interfaces cannot contain any code. They are also known as pure abstract contracts. An interface can contain only the signature of functions. It also cannot contain any state variables. They cannot inherit from other contracts or contain enums or structures. However, interfaces can inherit other interfaces. The function signatures terminate using the semicolon ; character. Interfaces are declared using the interface keyword following by an identifier. The next code example shows an implementation of the interface. Solidity provides the interface keyword for declaring interfaces. The IHelloWorld interface is defined containing two function signatures—GetValue and SetValue. There are no functions containing any implementation. IHelloWorld is implemented by the HelloWorld contract. Contract intent to use this...