+ 7

If structure can be used in cpp so why there are classes in cpp?

4th Oct 2017, 3:04 PM
Gourav raghuwanshi
Gourav raghuwanshi - avatar
3 odpowiedzi
+ 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]
4th Oct 2017, 3:26 PM
Babak
Babak - avatar
+ 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 .
4th Oct 2017, 3:15 PM
RZK 022
RZK 022 - avatar
+ 2
because C with classes (C++) was developed for the use of classes
4th Oct 2017, 6:07 PM
Gainza Koulaksezian Martín (Geka 👑)
Gainza Koulaksezian Martín (Geka 👑) - avatar