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 type of 'this' pointer? Explain when it is get created?

593


What are friend functions in C++?

629


What is class and structure in c++?

563


How are the features of c++ different from c?

600


How do I tokenize a string in c++?

614






What is the basic of c++?

612


Explain mutable storage class specifier.

639


Do vectors start at 0?

596


Do you know the problem with overriding functions?

578


What are the two types of comments, and how do they differ?

577


What's the best free c++ profiler for windows?

630


What is the difference between an external iterator and an internal iterator? Describe an advantage of the external iterator.

568


Write a program to find the Fibonacci series recursively.

618


How do you sort a sort function in c++ to sort in descending order?

566


write a program that withdrawals,deposits,balance check,shows mini statement. (using functions,pointers and arrays)

1810