Multiple choice technology programming languages

How much memory is allocated for objects of a class?

  1. Depending upon data members only

  2. Depending upon constructors, destructors, data members, member functions only.

  3. Depending upon data members and non static member functions only.

  4. Depending upon data members and non static member functions, constructors and destructors only.

  5. None of these

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

Object memory size in C++ and similar languages is determined by its non-static data members, plus padding and alignment overhead, as well as potential vtable pointers if virtual functions exist. Member functions and constructors do not duplicate code storage per object instance.