Read up on dynamic_cast. It does what you're asking for (keeping in mind that adding new shapes won't be as simple as creating new polymorphic classes), though I'm sure some OOP nazi will wander in and give you an overly complicated design pattern that will also solve the problem.
Last edited by Narue; Jun 12th, 2009 at 5:00 pm.
Reputation Points: 6442
Solved Threads: 1393
Bad Cop
Offline 11,807 posts
since Sep 2004