1.

Which among the following is the correct syntax to access static data member without using member function?(a) className -> staticDataMember;(b) className :: staticDataMember;(c) className : staticDataMember;(d) className . staticDataMember;This question was addressed to me by my college director while I was bunking the class.I'd like to ask this question from Static Data Members in section Exception Handling & Static Class Members of Object Oriented Programming

Answer»

Right choice is (b) className :: staticDataMember;

To explain I would say: For accessing the static data members without using the static MEMBER functions, the CLASS NAME can be USED. The class name FOLLOWED by scope resolution, indicating that static data members is member of this class, and then the data member name.



Discussion

No Comment Found

Related InterviewSolutions