🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: C++ Classes and Objects: all 10 questions

Quiz: C++ Classes and Objects · Question 9 of 10

Why can a static member function not use non-static data members directly?

Why can a static member function not use non-static data members directly?

  1. A.Static functions cannot take parameters
  2. B.Non-static members are private
  3. C.It is called without an object, so it has no this pointer
  4. D.It runs before main starts
Answer & explanation

Correct answer: It is called without an object, so it has no this pointer

Non-static members belong to a particular object, and a static function is not tied to one.

Can you get the rest right without peeking?

Take the timed Quiz: C++ Classes and Objects quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →