1.

Which among the following is true for public member functions?(a) Public member functions doesn’t have a return type(b) Public member functions doesn’t have any security(c) Public member functions are declared outside the class(d) Public member functions can be called using object of classThis question was posed to me in examination.My doubt stems from Public Member Functions topic in section Member Functions & its Types of Object Oriented Programming

Answer»

Right answer is (d) Public MEMBER functions can be called using object of class

The EXPLANATION: The public member functions can be called using object of the class. The members can’t be declared OUTSIDE the class as those WOULD become non-member functions of the class. The functions have security as those can be accessed using the class object only.



Discussion

No Comment Found

Related InterviewSolutions