Jumping into the question straight away.
Scenario-Steps:
1) I defines an interface
IMathBase
{
void Add(int a , int b);
void Sub(int a, int b);
}
2) A Concrete class PlusMinus implements IMathBase.
3) A Concrete class PlusMinusDiv implements IMathBase. PlusMinusDiv adds another function void Div(int a, int b)
4) IMathBase mathBase = new PlusMinusDiv();
5) mathBase.Div(10,20);
I know the step 5 is invalid. What is the best way to deal with the above situation[ to add a new method to a concrete class which implements a common interface]?
Thanks in advance.
Regards,
Joe
Either
or