113k views
4 votes
Class syntaxErrors1

{
public:
syntaxErrors( );
void setData(double, double);
int mult( );
private:
int one;
double two;
}

What line(s) have errors?

User Mezzie
by
8.1k points

1 Answer

4 votes

Final answer:

The code contains a mismatch error between the class name 'syntaxErrors1' and the constructor 'syntaxErrors'. The corrected line should match the class name with the constructor, and 'public' should be followed by a colon.

Step-by-step explanation:

The student has presented a snippet of C++ class code with a syntax error. The specific error is in the class name and constructor declaration. The class is named syntaxErrors1, but the constructor is named syntaxErrors without the '1', which is a mismatch. Constructors must have the same name as the class. Additionally, the keyword public should be followed by a colon to indicate the beginning of the public section of the class.

Corrected line with error:

class syntaxErrors1{public: syntaxErrors1(); ... }