Find the error(s) in each of the following and explain how to correct it (them):

a) Assume the following prototype is declared in class Time:
```
void ~Time( int );
```
b) The following is a partial definition of class Time:
```
class Time
{
public:
// function prototypes
private:
int hour = 0;
int minute = 0;
int second = 0;
}; // end class Time
```
c) Assume the following prototype is declared in class Employee:
```
int Employee( string, string );
```


a) Error: Destructors are not allowed to return values (or even specify a return type) or take arguments.
Correction: Remove the return type void and the parameter int from the declaration.
b) Error: Members cannot be explicitly initialized in the class definition.
Correction: Remove the explicit initialization from the class definition and initialize the data members in a constructor.
c) Error: Constructors are not allowed to return values.
Correction: Remove the return type int from the declaration.

Computer Science & Information Technology

You might also like to view...

A column, bar, area, dot, pie slice, or other symbol in a chart that represents a single data point.

What will be an ideal response?

Computer Science & Information Technology

Case-Based Critical Thinking QuestionsCase 6-2Bryan has just started an internship in which he uses a database frequently. The database contains information about the company's employees. Bryan's supervisor senses that he is anxious about using the database and drops by to give him a short tutorial. Bryan is told by the supervisor that to create a database, he first needs to create the database ____ itself, and then he can create the necessary database objects.

A. table B. field C. record D. file

Computer Science & Information Technology

Name and briefly explain five common analysis tools used during the systems analysis phase.

What will be an ideal response?

Computer Science & Information Technology

The ____________ generated by the control unit cause the opening and closing of logic gates, resulting in the transfer of data to and from registers and the operation of the ALU.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology