Consider:
// member data omitted for brevity
// assume that \"setAngle\" needs to be implemented separately
// in Label and Image, and that Button does need
This compiles on gcc 4.3.2 and is sort of a mixin pattern.
#include
using namespace std;
struct Point {
Point() : x(0), y(0) {}
Point(int x, int y) : x(x), y(y) {}
int x, y;
};
template
struct Widget {
T& move(Point newPos) {
pos = newPos;
return *reinterpret_cast (this);
}
Point pos;
};
template
struct Label : Widget