I want to check if something is valid using bool cast overload:
Menu::operator bool() const {
bool empty = false;
if (m_title == nullptr) {
empty = true;
}
return empty;
}
However when I used
if (Menu1) { cout << "valid"; }
It used int cast overload instead
Menu::operator int()
{
int choice = option();
return choice;
}