I'm an objective-C developer that's struggling with C++ code.
Below is the code I have in C++:
ULConnection *conn;
...... //code that builds up the connection
conn->GetLastError()->GetString(value, 255);
I need to create a local copy (not reference) of GetLastError()
.
How do I get a local reference and also check for null?
Here is my failed attempt:
ULError error = *conn->GetLastError();
if (&error != NULL){}
As per my understanding function
conn->GetLastError()
returns a pointer ofULError
and need to check is the return pointer is null or not.This will work for you.
Since C++11 you can do as follows instead comparing with
NULL