Ok, I'm trying to do the following:
protected bool ValidAdvert(Base item)
{
throw ThisIsAnAbstractClassException();
}
protected bool ValidAdvert(Derived1 item)
{
return ADerived1SpecificPredicate;
}
protected bool ValidAdvert(Derived2 item)
{
return ADerived2SpecificPredicate;
}
And the version of the Derived class of the method must be called when the base class is passed to the method. The base class is abstract, so is this theoretically possible?
Before someone says something about method overloading on the classes themselves, the logic inside the methods relies on a large number of different conditions, none of which are related, and none of them are directly related to the base / derived class (for example, how login status, etc.)
source
share