c++11 - C++: Creating a local copy of an Object -
i'm objective-c developer that's struggling c++ code.
below code have in c++:
ulconnection *conn; ...... //code builds connection conn->getlasterror()->getstring(value, 255);
i need create local copy (not reference) of getlasterror()
.
how local reference , check null?
here failed attempt:
ulerror error = *conn->getlasterror(); if (&error != null){}
as per understanding function conn->getlasterror()
returns pointer of ulerror
, need check return pointer null or not.
this work you.
const ulerror *error = conn->getlasterror(); if (error){}
since c++11 can follows instead comparing null
if( error != nullptr)
Comments
Post a Comment