Following are the differences between Structures in C and Structures in C++ :
- Structures in C cannot have Direct functions/methods inside a structure definition[But it still can have methods in the form of function pointers]. While structures in C++ can have functions/methods inside a structure definition.
- In C, an object(variable) of a structure is created using the keyword struct(otherwise syntax error). For example struct student sid; Whereas in C++ the struct keyword can be omitted while creating structure variables(objects). For example: student sid;
- C structures does not permit Data hiding concept whereas C++ structures allow Data hiding.

0 comments:
Post a Comment