I have an Abstract Shape class that has ten concrete children (Point, Line, Triangle, Rectangle, Arc, Sector, Circle, Ellipse, Spline, Polygon). I want to add collision shapes to my physics engine but only allow for the use of Point, Rectangle, and Circle. Possibly also Line and/or Triangle, if I can get them to work.
Is this possible WITHOUT using overloaded methods (including template specialization)?
In this situation, you need another class (or interface, in other languages), eg CollisionShape, which Point, Rectangle, and Circle derive from/implement, while the others do not. And it is classes deriving from CollisionShape which the physics engine would accept, instead of Shape.