1.

Which among the following is correct to call a private member from outside the class?(a) object.memberfunction( parameters );(b) object->memberfunction( parameters );(c) object->memberfunction( parameteres); or object.memberfunction( parameters );(d) Not possibleI have been asked this question by my school teacher while I was bunking the class.Question is from Private Access Specifier in chapter Access Specifiers of Object Oriented Programming

Answer»

The correct choice is (d) Not possible

Best explanation: The private MEMBER FUNCTION will not be accessible from outside the class. Hence any SYNTAX will not work to access the private members. If you have the address of the member, may be you can access those members, but that is a totally DIFFERENT CASE and concept.



Discussion

No Comment Found

Related InterviewSolutions