If structure can be use, then why there're classes in cpp? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

If structure can be use, then why there're classes in cpp?

Just Wanna know.

6th Aug 2020, 4:32 PM
Raju
Raju - avatar
2 Antworten
+ 1
structures are a feature C++ took over from C to maintain comparability. classes are a new feature added in C++ to extend the functionality of structures for better OOP.
6th Aug 2020, 4:42 PM
Aaron Eberhardt
Aaron Eberhardt - avatar
0
In common way you can use structures the same way as classes, with methods, data encapsulates polymorphysm. BUT structure is feature of C language, and it is more correct in term of visual representation estetic, view that use class.
6th Aug 2020, 5:06 PM
george
george - avatar