I have a class:
class Impl1 : public POA_I1
{
private :
Impl2_var ob;
public :
Impl2_ptr get();
{
return ob;
}
void set(::Impl2_ptr ob)
{
this->ob = ob;
}
};
I'm a litte bit confused about _ptr
and _var
. I read that
MyObject_var The _var version of the object reference type acts as a handle toproxy in much the same way as a _ptr reference but also adds memory management. Like all _var types, a _var reference takes care of deallocating its underlying instance (in this case, the proxy instance) when the reference goes out of scope. Both _ptr references and _var references allow the client to access operations onproxy instance
but I dont understand when to use each one and why. I mean, in my implementation = which one should I use, _var
or _ptr
and why? And is it legal to have a field of type _var
in class and return _ptr
in setter? I just don't get it at all.