Hello everybody!
I'm trying to display the result of addition of vectors. But Builder shows the error after compilation (line 29). What should I change for in my code in order to find the problem?
Thanks in advance.
#include <iostream.h>
#include <iomanip.h>
#include <conio.h>
class CVector2D {
public:
CVector2D(double x0 = 0, double y0 = 0)
:x(x0), y(y0)
{
}
double x, y;
CVector2D const operator +(CVector2D const& vector2)const {
return CVector2D(x + vector2.x, y + vector2.y);
}
};
using namespace std;
int main()
{
CVector2D a(3.0, 5.8);
CVector2D b(7.3, 8.8);
CVector2D c = a + b + CVector2D(3, 9);
cout << "Sum is equal " << c << endl;
getch();
return 0;
}
Error (line 29):
[C++ Error] 5.cpp(27): E2094 'operator<<' not implemented in type 'ostream' for arguments of type 'CVector2D'