I've a struct like this (I've coded the C struct
like a C++ class
to demonstrate what I am thinking; but I am working in C.):
//This is a source file
typedef struct _MyType
{
void test() { printf("works!"); }
}MyType;
But I want to define my struct like that: (That not works)
//This is a header file
typedef struct _MyType
{
void test();
}MyType;
//This is a source file
MyType::test() { printf("works!"); }
I've tried some more things but I can't do it again. (I want to use structs
like classes
)
How can I achieve this OOP-like separation in C?