1.

Which of the following is correct about static variables?(a) Static functions do not support polymorphism(b) Static data members cannot be accessed by non-static member functions(c) Static data members functions can access only static data members(d) Static data members functions can access both static and non-static data membersI have been asked this question by my school teacher while I was bunking the class.The doubt is from Static Constant Keyword topic in section Basics Concepts of C++ of C++

Answer»

The correct option is (C) STATIC data MEMBERS functions can ACCESS only static data members

Best EXPLANATION: Static member functions can access static data members only. Static member functions can be overloaded. Static data members can be accessed by non-static member functions.



Discussion

No Comment Found

Related InterviewSolutions