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

What is the sequence of destruction of local objects?

556


If you hear the cpu fan is running and the monitor power is still on, but you did not see anything show up in the monitor screen. What would you do to find out what is going wrong?

546


What is recursion?

657


What are destructors?

571


Why pointer is used in c++?

612






What happens when you make call 'delete this;'?

603


I was a c++ code and was asked to find out the bug in that. The bug was that he declared an object locally in a function and tried to return the pointer to that object. Since the object is local to the function, it no more exists after returning from the function. The pointer, therefore, is invalid outside.

607


What is the role of C++ shorthand's?

674


What is difference between malloc()/free() and new/delete?

644


can any one help to find a specific string between html tags which is changed to a sting.. weather.html looks (for location) is somewhere #include #include #include using namespace std; string find_field(string myPage,string); int main (void) { string page, line, location, temperature; ifstream inputFile("weather.xml"); while(getline(inputFile, line)) { page.append(line); line.erase(); } // Now page is a string that contains the whole xml page // Here you need to write something that finds and // extracts location and temperature from the XML // data in the string page and stores them in // the strings location and temperature respectively location=find_field(page,"location"); temperature=find_field(page,"temp_c"); cout << "Location: "<

1641


what kind of projects are suitable for c and c++

623


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

592


What is pointer to array in c++?

615


Evaulate: 22%5 a) 2 b) 4 c) 0

665


Give the difference between the type casting and automatic type conversion. Also tell a suitable C++ code to illustrate both.

628