Software Development Fundamentals — Question 34

The purpose of a constructor in a class is to:

Answer options

Correct answer: A

Explanation

The correct answer is A because a constructor is specifically designed to initialize an object of a class when it is created. Options B, C, and D are incorrect as they refer to resource management, value type generation, and inheritance respectively, which are not the primary functions of a constructor.