What are the differences between struct and class in C++?

C++Server Side ProgrammingProgramming

The members and base classes of a struct are public by default, while in class, they default to private. Struct and class are otherwise functionally equivalent.

They are however used in different places due to semantics. a struct is more like a data structure that is used to represent data. class, on the other hand, is more of a functionality inclined construct. It mimics the way things are and work.

raja
Published on 28-Feb-2018 14:26:34
Advertisements