+ 1
Can classes be thought as structures in c?
2 Réponses
+ 1
Avinesh
You are right on first point... but second point is not. structures in C can have member functions as well.
As an example:
struct test {
int x, y;
int (*cmp)(void *a, void *b);
void (*print)(int value);
};
0
Yes you can say that, one common difference is that all the structure members are by default public whereas all class members are by default private.
Structures in C cannot have member functions whereas classes in C++ can.