Multiple choice

Member functions can be defined

  1. outside the class definition

  2. inside the class definition

  3. both inside & outside the class definition

  4. none of the above

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

C++ allows member functions to be defined either inside the class definition (implicitly inline) or outside the class using the scope resolution operator (::). Defining inside is convenient for short functions, while defining outside keeps the class interface clean. Both approaches are valid and commonly used depending on function complexity and coding style preferences.