What is difference between a structure and class? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is difference between a structure and class?

22nd Feb 2019, 2:43 PM
Raj Jaiswal
Raj Jaiswal - avatar
2 Answers
+ 1
in c++ a struct is simply a class with members public by default: struct app { class app { int value <=> public: int value; }; };
22nd Feb 2019, 3:37 PM
MO ELomari
MO ELomari - avatar
0
Class it is identifiable entity that share common characteristics & behaviour with object Structure collection of data items in desired manner structure can only have the parameterized constructor.it means a structure can not have non-parameterized constructor default constructor and destructor.
24th Feb 2019, 11:15 AM
Ayush Dixit
Ayush Dixit - avatar