[osg-submissions] osg::Object::clone
Michael Platings
mplatings at pixelpower.com
Fri Jun 6 05:49:45 PDT 2008
I'll preempt Robert's reply by telling you that the purpose of clone()
is to permit cloning an object of unknown type.
With the changes you have made, the following code will fail:
Object* a = new Transform();
Transform* b = dynamic_cast<Transform*>(a->clone());
assert(b);
-----Original Message-----
From: osg-submissions-bounces at lists.openscenegraph.org
[mailto:osg-submissions-bounces at lists.openscenegraph.org] On Behalf Of
??????? ?????
Sent: 06 June 2008 13:25
To: osg-submissions at lists.openscenegraph.org
Subject: [osg-submissions] osg::Object::clone
Hi, Robert!
I suggest to you to override type of returning value in realizations of
functions osg::Object::clone and osg::Object::cloneType in derived
classes. In this case one will be able to write simply "osg::Transform*
sTrans = sExistentTrans->clone();" instead of "osg::Transform* sTrans =
dynamic_cast<osg::Transform*>(sExistentTrans->clone());".
It is very simple to realize such behavior, three changed files are
attached in archive, changes are based on revision 8416.
Best regards,
Valery
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
______________________________________________________________________
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
More information about the osg-submissions
mailing list