Google News
logo
CPP - Interview Questions
What is the difference between struct and class?
In C++ a structure is the same as a class except for a few differences like security. The difference between struct and class are given below :

Structure Class
Members of the structure are public by default. Members of the class are private by default.
When deriving a struct from a class/struct, default access specifiers for base class/struct are public. When deriving a class, default access specifiers are private.
Advertisement