SFML community forums

Help => Graphics => Topic started by: doingit on March 08, 2016, 08:34:08 pm

Title: Inherits: Rectangle Shape, cannot call move method?
Post by: doingit on March 08, 2016, 08:34:08 pm
Hi everyone,

As the title states, I am having issues calling an inherited method "move(10.f,10.f)" from the Rectangle Shape class.
Example below:
    //What we'd could normally do:
    sf::RectangleShape aRectShape;
    aRectShape.move(10.f,10.f);//Works
   
    //In a class that inherits Rectangle Shape:
    this->move(10.f,10.f);//Does not work;
From my understanding, the Rectangle Shape class that I have inherited, also inherits a move from the transformable class. Why am I not allowed to access the move method from Rectangle Shape in its child class that I've created?

Thanks.
Title: Re: Inherits: Rectangle Shape, cannot call move method?
Post by: Laurent on March 08, 2016, 08:44:54 pm
Show the definition of the class, and most important, the compiler error that you get.
Title: Re: Inherits: Rectangle Shape, cannot call move method?
Post by: doingit on March 08, 2016, 09:14:25 pm
Sorry, my mistake =D
Sleep deprive caused me to overlook something, a simple c++ error, thanks.

Edit: Solved.

For completeness, it was due to multiple inheritance, and me not properly removing ambiguity.
Basically sf::Rectangle Shape was inheriting the move method from sf::transformable and I from sf::Rectangle Shape.

So the call: sf::RectangleShape::move(/*stuff*/) allowed me to access the move method from sf::transformable.
Title: Re: Inherits: Rectangle Shape, cannot call move method?
Post by: Hapax on March 08, 2016, 09:31:16 pm
As a guess, I'd say that you forgot to add the "public" keyword to your inheritance declaration?