1.

If private members are to be called outside the class, which is a good alternative?(a) Call a public member function which calls private function(b) Call a private member function which calls private function(c) Call a protected member function which calls private function(d) Not possibleThe question was posed to me in an international level competition.My question is from Private Member Functions topic in division Member Functions & its Types of Object Oriented Programming

Answer»

Correct option is (a) Call a public member function which calls private function

For EXPLANATION: The private member FUNCTIONS can be accessed within the class. A public member function can be called which in TURN calls the private member function. This maintains the security and adheres to the rules of private members.



Discussion

No Comment Found

Related InterviewSolutions