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 an incomplete type in c++?

754


Which compiler does turbo c++ use?

592


Write a program to interchange 2 variables without using the third one.

572


How do you find out if a linked-list has an end? (I.e. The list is not a cycle)

590


What is stoi in c++?

684






What is a float in c++?

535


Which programming language should I learn first?

568


What is binary search in c++?

552


Do you know the use of vtable?

615


Show the declaration for a static member variable.

514


What is the difference between set and map in c++?

595


what do you mean by volatile variable?

572


What is capacity in vector in c++?

531


What is iomanip c++?

588


What is the default access level?

606