> > Where "sphere" is a pointer to an existing Sphere?
> > "typeid" replaces getCLassIndex?
> Ah, no... it must be the class "Sphere" itself obviously?
> Is there really nothing like classIndex now? Just curious.
There still is getClassIndex(), but it is more complicated and possibly
slower: you need to get index of sphere first, remember it somewhere
etc. typeid is standard operator, which accepts type or object.
Therefore you can test if(typeid(*b->shape)==typeid(Sphere)); the
disadvantage is that (unlike dynamic_cast), it will be false for Shapes
derived from Sphere, which is not so much concern, I think;
getClassIndex() would fail there, too.

v



_______________________________________________
Mailing list: https://launchpad.net/~yade-dev
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~yade-dev
More help   : https://help.launchpad.net/ListHelp

Reply via email to