Hi all,
Do you know if it is possible to hide class methods when the class has
not been "properly" instantiated?
Say in the following example, I'd like to hide or disable Drive() when
the numWheels == 0.
class Car
{
int _numWheels;
Car()
{
_numWheels = 0;
}
Car(int numWheels)
{
_numWheels = numWheels;
}
void Drive() {...}
}
I don't suppose there's a way to do it, other than checking numWheels >
0 in each class method.
What's the proper way to do this? How do you guys handle this
situation?
Thanks,
Andre