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

Answer Posted / manjusinga

public is used for global access that is its scope is not
only within the class but also outside the class.

private is used only in the class class in which it is
defined.It cannot be accessible by its derived members.

protected is used within the class in which it is defined
and derived members of it can also access it.

Is This Answer Correct ?    133 Yes 10 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is guard code in c++?

638


What is iterator in c++?

608


What does the following do: for(;;) ; a) Illegal b) Loops forever c) Ignored by compiler...not illegal

693


What is atoi in c++?

567


What do you mean by “this” pointer?

615






Is it possible to provide default values while overloading a binary operator?

764


What is c++ best used for?

565


How does c++ sort work?

560


How do we balance an AVL Tree in C++?

632


Implement stack operations with pointers with appropriate exception checks.

567


Explain the purpose of the keyword volatile.

633


Reads in the size of a square from the screen; 2. Prints a hollow square of that size out of “-“, “|” and blanks on screen; 3. Prints the same hollow square onto a text file. Your program should work for squares of all side sizes between 1 and 20. --- │ │ │ │ │ │ ---

1643


What are the different types of comments allowed in c++?

577


What are the vectors in c++?

579


Can non graphic characters be used and processed in C++?

702