Header Ads Widget

Different between class and structure in C++ || Class vs Structure

 

Different between Class and Structure in C++




 

Class

Structure

Class is defining using keyword class.

Structure is defining using keyword structure.

Class is a collection of data member and member function.

Structure is a collection of data variables.

Class member are private by default.

Structure member are public by default.

Class can be inherited.

But structure can’t be inherited.

It takes more space.

It takes less space.

Post a Comment

0 Comments