Multiple choice technology programming languages

Which of the following functions initalizes the variables contained in a class:

  1. Constructor

  2. Destructor

  3. Constitutor

  4. None of the Above

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

A constructor is a special member function that initializes the data members of a class. It has the same name as the class and is automatically called when an object is created. Destructors clean up resources when objects are destroyed, and 'Constitutor' is not a valid C++ term.