Which of the following are correct?

a) A constructor must be declared for each class.
b) A constructor must be declared with a return type
c) A default constructor can only be provided by the compiler.
d) A class can have only one default constructor.
e) A class can have only one constructor.

d) A class can have only one default constructor.

a) is wrong. The compiler will provide a default constructor if the class
author does not. b) is wrong. In fact, a constructor may not have a return type. c) is
wrong. In fact, as we will see later in this course, if the class author provides a
constructor, the compiler will not provide a default constructor. If default constructor
is needed under these circumstances, the class author must provide one.

Computer Science & Information Technology

You might also like to view...

When using amplitude modulation, does it make sense for a 1 Hz carrier to be modulated by a 2 Hz sine wave? Why or why not?

What will be an ideal response?

Computer Science & Information Technology

The smart guides appear ____ when the frame is touching both the left margin guide and the horizontal guide.

A. blue B. pink C. red D. green

Computer Science & Information Technology