SFML community forums
Help => Graphics => Topic started by: lorence30 on July 05, 2015, 05:42:32 pm
-
Im trying to derived from sf::RenderWindow class.
and my question is what are my disadvantages if i do this?
-
May I ask why?
What changes would you be making and what would the derived class be?
-
Just a WindowManager class that has full of static members.
and i dont have any plan on changing the sf::RenderWindow class.
-
It then may be a better choice to just store a RenderWindow as a member.
There's the whole thing about class inheritance where if you inherit from some other class, then it becomes one. "is a"...
"WindowManager is a RenderWindow" doesn't make sense so inheritance is probably not the right choice here.
-
@Hapax
got it! thanks man!
-
Im trying to derived from sf::RenderWindow class.
and my question is what are my disadvantages if i do this?
"Why not" is the wrong question. If you do something, you should have a good reason to do it in the first place, not have no reason against it.
Just a WindowManager class that has full of static members.
:o ... and you call that "just"
Don't do that. Both "managers" without clear area of responsibility and "full of static members" are very bad habits. They seem to simplify things, but make everything more complex as soon as you move away from the most basic designs.
Find a good use case for your class, and name it appropriately. Split where necessary.