What is the Difference between struct and class in terms of Access Modifier?

Options
- By default all the struct members are private while by default class members are public.
- By default all the struct members are protected while by default class members are private.
- By default all the struct members are public while by default class members are private.
- By default all the struct members are public while by default class members are protected.


CORRECT ANSWER : By default all the struct members are public while by default class members are private.

Discussion Board
C++ - Difference between Class and Structure

All members of a class are private by default, whereas fields of a structure are public. Default access of a base class is private for classes and public for structures.

Prajakta Pandit 01-24-2017 12:45 AM

c++

amazing....i like that all question related to interviews....

vinay sharma 04-5-2014 08:07 AM

Write your comments


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)


Advertisement