Hi,
 
As I'm a new user of OpenSceneGraph, pardon me for this simple question:
 
For the following class:
 
class Foo
{
public:
    Foo() {}
   virtual ~Foo() {}
 
private:
    osg::ref_ptr<osg::Node> mNode;
};
 
since mNode is a pointer, is it a must to provide a copy constructor and 
assignment operator for deep copy to prevent dangling pointer?
 
If there is a need to provide the copy constructor and assignment operator, is 
it correct as illustrated by the codes below?
 
Foo(const Foo& other)
{
    mNode = other.mNode;
}
 
Foo& operator=(const Foo& other)
{
    if (this == &other)
        return *this;
 
   mNode = new osg::Node;
    mNode = other.mNode;
    return *this;
}
 
Thanks,
Yip Leng


      New Email names for you! 
Get the Email name you&#39;ve always wanted on the new @ymail and @rocketmail.. 
Hurry before someone else does!
http://mail.promotions.yahoo.com/newdomains/sg/
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to