Don't define them in RectSolid at all. RectSolid will inhert all of its parent's members automatically. |
Yes, but I want to override the other class's definition, but use it in my own definition at the same time. My alternative would be to do this:
1 2 3 4 5
|
void Slide(float XOffSet, float YOffSet)
{
Move(XOffSet, YOffSet);
OffSet(XOffSet, YOffSet);
}
|
The reason for this is because the sf::Rect class has a method called 'OffSet' which is equivalent to sf::Shape's move, just on the Rect, not the Shape.
To be clear, the difference between sf::Shape and sf::Rect is that sf::Rect is just coordinates that make it easier to manipulate sf::Shapes and sf::Sprites, while sf::Shape is a drawable object which can be moved, but is a pain to manipulate if not paired with an sf::Rect. I'm trying to make a class that brings them together and so that I can manipulate it without having to worry about sf::Rect's coordinates matching sf::Shape's.
To be even clearer, the Left, Top, Right, Bottom in the constructor are members of sf::Rect, while the AddPoint method is part of the sf::Shape.
Side note: you should probably make inheritance public for all parent classes (I assume this was your intent):
class RectSolid : public sf::Shape, public sf::Rect<float> // each parent needs 'public' |
Yes, that was my intent :). Thanks.