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

Popular posts from this blog

html - How can i make an element from a bottom stacking context stays in front of another higher stacking context? -

python - TypeError: start must be a integer -

html - href attribute breaking an element -