Skip to main content
gamedev.net
🔒 Locked

shared_ptr and constructor

Started by juglar 1 reply 900+ views
Original Post
juglar
juglar
Hi Folks!!, how can i declare the shared_ptr and after in my code give the constructor parameter i mean class Object{ Object(Other* oth){ .. .. .. } }; shared_ptr object // declare ... ... .. ... Other hello; obj(hello); i don't want to use an extra method to pass the object (hello), it that posible ?? tnx in advace!!
EvaldsUrtans
EvaldsUrtans
If this what you need:

shared_ptr pObject(new Object(pOther));

or

shared_ptr pObject; //By default NULL
pObject.reset(new Object(pOther));
juglar
juglar
ok that is thanks!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.