+ 7
If structure can be used in cpp so why there are classes in cpp?
3 Réponses
+ 13
I agree with Gamma. C++ can't afford to forget its legacy due to the fact that we are still dealing with some legacy code written in C++. But class introduced by C++ and as you know has some minor differences compared to structure. the following link is a discussion about that matter and worth to see.
[https://stackoverflow.com/questions/54585/when-should-you-use-a-class-vs-a-struct-in-c]
+ 5
It's a question that arises many times , actually when c was created , it had structures , but no classes ,but when they introduced classes , they thought of keeping it . So they didn't remove it , that's only the reason . Nothing else .
+ 2
because C with classes (C++) was developed for the use of classes