In my method in my class, I'm checking if a value is 0 to return nullptr
, however I can't seem to do that.
Complex Complex::sqrt(const Complex& cmplx) {
if(cmplx._imag == 0)
return nullptr;
return Complex();
}
The error I'm getting is: could not convert 'nullptr' from 'std::nullptr_t' to 'Complex'
I realize now, that nullptr
is for pointers, however, my object is not a pointer, is there a way for me to set it to null or something similar?