223k views
2 votes
What is the return type of a constructor function?

A) int
B) float
C) char
D) structure pointer
E) None of these

1 Answer

3 votes

Final answer:

The return type of a constructor function is void.

Step-by-step explanation:

The return type of a constructor function is void. Unlike other functions, constructors do not have a return type because their main purpose is to initialize objects of the class they belong to. Constructors are called automatically when an object is created, and their return type is automatically set to void.

User Jon Lachonis
by
8.6k points