Developing Yed objects - Interface definition
Once you have identified the entity to translate in an object, you must identify attributes and methods of this object in order to build his interface. Moreover, you must set the access type of this elements: are they public or private? Protected type is not considered in this scenario.
This step is very easy to implement in a C++ environment; this is a simple code that you could write :
// C++ ENVIRONMENT
Using C language, you can realize the same simple interface definition as above.
First of all, you can substitute the 'class' keyword with the more similar keyword in C environment: 'struct'. Then, you can substitute the declaration of My_Func with a pointer to a function called My_Func, and all become like this:
// C ENVIRONMENT
In this way, you have defined a C interface equal to C++ interface defined above: the C compiler allows the declaration of function pointers inside structures.
Moreover, My_Func pointer is addressable through an instance of the structure Myclass, exactly as C++ example, in that My_Func is instanceable through an object of Myclass type. In this way, you don't have only incapsulated my_attr attribute, but you have also incapsulated the method My_Func directly in the Myclass interface definition, in both C and C++ environment.
Obviously, My_Func pointer in C environment is not still initialized, as well as My_Func method in C++ environment is not still initialized; but now is the time to set access type of Myclass attributes and methods in both environment.