1.

Correct syntax to access the static member functions from the main() function is ______________(a) classObject::functionName();(b) className::functionName();(c) className:classObject:functionName();(d) className.classObject:functionName();The question was asked in a national level competition.I want to ask this question from Types of Member Functions topic in chapter Member Functions & its Types of Object Oriented Programming

Answer»

Right choice is (B) CLASSNAME::functionName();

Easy explanation - The syntax in option b must be followed in order to CALL the static functions directly from the MAIN() FUNCTION. That is a predefined syntax. Scope resolution helps to spot the correct function in the correct class.



Discussion

No Comment Found

Related InterviewSolutions