Suppose I wrote a C ++ program without using RTTI and polymorphism at runtime (no virtual function, no virtual inheritance), and classes do not have private / protected members, and special C ++ header files are not used (i.e. . use the C header files: cstring, cstdio... instead string, iostream...).
Then I want to write a similar program in C, to which the first type of function argument corresponds to the corresponding one struct.
For instance:
struct Custom
{
int a;
Custom() { }
void change() { }
~Custom() { }
};
int main()
{
Custom m;
m.change();
}
struct Custom
{
int a;
};
void custom_init(Custom* like_this) { }
void custom_change(Custom* like_this) { }
void custom_destroy(Custom* like_this) { }
int main()
{
Custom m;
custom_init(&m);
custom_change(&m);
custom_destroy(&m);
}
++ , C- ()? , C ? , ++ RAII , ?
, , C ... ?
: ? , ++ - , , ( ? ? ?).