221k views
2 votes
C++ programming true or false questions

1. We have a class called animalType. Answer the following questions about clas animalType.

a. Its constructors will be named animalType. (True or False)

b. Return type of its constructors will be void. (True or False)

User EnduroDave
by
5.5k points

1 Answer

4 votes

Answer:

a. True

b. False

Step-by-step explanation:

Constructor is used to initialize the object of the class.

Rules of constructor:

1. Constructor name must same as the class name. it means, if the class name is animalType, then constructor name must be animalType.

2. Constructor does not have any return type. it means, it does not return anythings.

Therefore, part (a) is true, Constructor name must same as the class name.

and part (b) is false, because constructor does not have any return type.

User Andy Poes
by
5.3k points