Operator overload går ikke helt efter planen
Hej eksperterJeg har igen problemer med den koordinatklasse. Det har virket så jeg har selv skabt problemet ved at forsøge at flytte funktionerne ud af klassen. Lidt nedbarberet har jeg koden:
#include <iostream>
#include <string>
#include <vector>
using namespace std;
class Point
{
public:
Point(const int&, const int&);
~Point(void);
class Coor
{
public:
Coor(const int&);
~Coor(void);
Coor & operator ++();
int c;
};
Coor x;
Coor y;
};
int main()
{
Point a(2,2);
a.y++;
return 0;
}
Point::Point(const int& aX, const int& aY) : x(aX), y(aY)
{
}
Point::~Point(void)
{
}
Point::Coor::Coor(const int& aC)
{
c=aC;
}
Point::Coor::~Coor(void)
{
}
Point::Coor &Point::Coor::operator ++()
{
c++;
return *this;
}
Jeg får følgende fejl: J:/Source/windows.cpp:39: error: no `operator++(int)' declared for postfix `++
Er der en, der kan se, der der går galt?