[osg-submissions] osg::Object::clone

Jean-Sébastien Guay jean-sebastien.guay at cm-labs.com
Fri Jun 6 05:57:45 PDT 2008


Hello Michael,

> With the changes you have made, the following code will fail:
> 
> Object* a = new Transform();
> Transform* b = dynamic_cast<Transform*>(a->clone());
> assert(b);

Will it? Just playing Devil's advocate here, I don't care either way, 
and I may be showing my poor C++ skills, but since the clone() method is 
virtual, a->clone() will return a Transform* (with Valery's changes), 
and dynamic_casting a Transform* to a Transform* will just be a no-op 
and return the same object, so the assert will not fail...

Or am I seeing this wrong?

J-S
-- 
______________________________________________________
Jean-Sebastien Guay    jean-sebastien.guay at cm-labs.com
                                http://www.cm-labs.com/
                         http://whitestar02.webhop.org/


More information about the osg-submissions mailing list