0

"return type may not be specified on a constructor"

I am getting this error in VS10. Here's my code: (the error appears on the word class)

ComplexNumDec.h

class ComplexNum{
private:
	double real;
	double imag;
public:
	ComplexNum(double x, double y);
	~ComplexNum();
	ComplexNum operator+(ComplexNum x);
	ComplexNum operator-(ComplexNum x);
	ComplexNum operator*(ComplexNum x);
}

I also have a file ComplexNum.h which fleshes out those functions. Here is my function for the constructor:

ComplexNum::ComplexNum(double x, double y){
real = x;
imag = y;
}

I have a main.cpp file too.

Can anyone explain why I am getting the error:
"return type may not be specified on a constructor"

1
Contributor
1
Reply
6
Views
7 Years
Discussion Span
Last Post by WallyBags
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.