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

Answer Posted / prashant kalmodiya

PUBLIC: Specifies that those all members are accessible
from any function.

PRIVATE: Specifies that those members are accessible only
from member functions and friends functions of the class.

PROTECTED: Specifies access to class members in the member-
list up to the next access specifier (public or private)

Is This Answer Correct ?    18 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can we specify variable field width in a scanf() format string? If possible how?

666


Differentiate between the message and method in c++?

612


If a header file is included twice by mistake in the program, will it give any error?

552


Explain what are single and multiple inheritances in c++?

561


What are the extraction and insertion operators in c++? Explain with examples.

655






What gives the current position of the put pointer?

565


How do you define a class in c++?

646


How do I write a c++ program?

598


What is ios class in c++?

581


What is the main purpose of overloading operators?

592


Can we make copy constructor private in c++?

603


Explain how to initialize a const member data.

599


Is java a c++?

565


What does new do in c++?

637


How to declaring variables in c++?

663