Class vs structure by R4R Team

Difference between Class and Structure in C++ :
-Class is pass-by-reference and Struct is pass-by-copy,
-Class can create a subclass that will inherit parent's properties and methods, whereas Structure does not support the inheritance.
-A class has all members private by default. A struct is a class where members are public by default.
-Sizeof empty class is 1 Byte where as Sizeof empty structure is 0 Bytes
-Classes are still fit for larger or complex objects and Structs are good for small, isolated model objects.




Leave a Comment:
Search
Categories
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!