operator bool() const
{
return col != 0;
}
Defines how the class is convertable to a boolean value, the const
after the ()
is used to indicate this method does not mutate (change the members of this class).
You would usually use such operators as follows:
airplaysdk sdkInstance;
if (sdkInstance) {
std::cout << "Instance is active" << std::endl;
} else {
std::cout << "Instance is in-active error!" << std::endl;
}