1.

How can a static member function be called in the main function?(a) Using dot operator(b) Using arrow operator(c) Using dot or arrow operator(d) Using dot, arrow or using scope resolution operator with class nameI had been asked this question by my college professor while I was bunking the class.I would like to ask this question from Member Functions topic in portion Class Members & Types of Object Oriented Programming

Answer»

Correct choice is (d) USING DOT, arrow or using scope RESOLUTION operator with class name

The best I can explain: The member functions can be called using only the dot operator or the arrow operator. But the static members can be called using directly the class name FOLLOWED by the scope resolution operator and static member function name. This is useful when you don’t have any object to call the member.



Discussion

No Comment Found

Related InterviewSolutions