Friday, 19 August 2016

C++ - struct vs. class


Possible Duplicates:
C/C++ Struct vs Class
What are POD types in C++?






Hi,



In the C++ In a Nutshell book, in chapter 6: classes, unders Access specifiers, mentioned the following:





In a class definition, the default
access for members and base classes is
private. In a struct definition, the
default is public. That is the only
difference between a class and a
struct
, although by convention, some
programmers use struct only for POD
classes
and use class for all other
classes
.





My questions here are:




  • Isn't there another difference between classes and structs in that structs don't hold functions and just hold data?

  • What are POD classes? And, what is meant by all other classes here? Are there then special classes?



Thanks.

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...