What are the differences between public, private, and
protected access?

Answer Posted / golledla prathap reddy

public data can access anybody in the program.
private data can access olny members of that class.
protected also same like private but the difference is it
can access by derive class also.
we can see the use of protected data in inheritance.

Is This Answer Correct ?    64 Yes 12 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Describe the process of creation and destruction of a derived class object?

622


Explain the isa and hasa class relationships. How would you implement each?

582


What do you mean by inheritance in c++?

572


What is atoi?

515


What is c++ hash?

587






How to allocate memory dynamically for a reference?

520


What is c++ manipulator?

531


Define 'std'.

583


When is the destructor called?

583


what is a class? Explain with an example.

591


Is c++ a good first language to learn?

550


What is guard code in c++?

610


What are the various operations performed on stack?

608


Define upcasting.

566


What language is a dll written in?

519