C++ | Static Keyword | Question 3
Which of the following is true?
(A) Static methods cannot be overloaded.
(B) Static data members can only be accessed by static methods.
(C) Non-static data members can be accessed by static methods.
(D) Static methods can only access static members (data and methods)
Explanation: A static function is a special type of function which is used to access only static data, any other normal data cannot be accessed through static function.
Just like static data, static function is also a class function, it is not associated with any class object.
Static method overloaded and static method can access only static members.
Option (D) is correct.
Quiz of this Question