Computer Science - Object Oriented Programming Using C++ - Discussion


The program can access the private members of a class

[A]. directly
[B]. only through other private members of the class
[C]. only through other public members of the class
[D]. None of the above - the program cannot access the private members of a class in any way

Answer: Option C


No answer description available for this question.

Sangeeta said: (Apr 21, 2017)  
How it is possible.?

We can not access private members of a class through public members.

Geetha said: (Mar 26, 2018)  
I think the option is 'B'.

Niranjan said: (Oct 31, 2022)  
The class members declared as private can be accessed only by the member functions inside the class.

They are not allowed to be accessed directly by any object or function outside the class. Only the member functions or the friend functions are allowed to access the private data of members of the class.

Post your comments here:

Name *:

Email   : (optional)

» Your comments will be displayed only after manual approval.