Defining interfaces
C modules may also define interfaces. An interface definition starts with the macro A_INTERFACE, and ends with A_END_INTERFACE(). The contents of the interface, including its members and superinterface (if any), are defined within these macros using the same macros that are used for defining classes. These macros are described in the previous section.
In particular, the following macros (and their different variants) can be used within interfaces:
- A_METHOD for defining interface methods
- A_GETTER for defining getters
- A_SETTER for defining setters
- A_INHERIT for interface inheritance
When using macros A_METHOD, A_GETTER or A_SETTER, replace the implementation function pointer with NULL, since there is no implementation. Example:
A_INTERFACE("Example") A_GETTER("a", 0, NULL) A_END_INTERFACE()