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) is the only one that is correct.
Explanation: 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...

Referring to the accompanying figure, which of the following is pointed to by callout E?

A. microphone B. camera C. memory card slot D. USB port

Computer Science & Information Technology

Show the output of the following code:

``` #include using namespace std; class Count { public: int count; Count(int c) { count = c; } Count() { count = 0; } }; void increment(Count c, int times) { c.count++; times++; } int main() { Count myCount; int times = 0; for (int i = 0; i < 100; i++) increment(myCount, times); cout << "myCount.count is " << myCount.count; cout << " times is " << times; return 0; } ```

Computer Science & Information Technology

In a database, data is stored in a(n) ________

Fill in the blank(s) with correct word

Computer Science & Information Technology

Answer the following statement(s) true (T) or false (F)

1. The Oil Paint filter allows you to correct perspective errors and straighten curves and lines in photos taken with a wide-angle lens. 2. Some filter effects can be memory-intensive, especially when applied to a high-resolution image. 3. A smart filter is a substitute to creating a copy of the layer on which to apply filters, and renaming it to include the filter name and settings. 4. The Polygon Tool options bar allows you to fill, stroke, set the width, choose the number of sides, and select other tools to work with paths. 5. Typefaces are only available in the Postscript format.

Computer Science & Information Technology