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)
Answer: (D)
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
Last Updated :
29 Jul, 2020
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...