If I have a reference of an interface assigned to a concrete class which implements that interface can I call methods that are defined in the implementing class but not declared in the interface ?
for example :
my interface is
my abstract class is
my concrete class is
my
test class is
I cannot call method2 on the obj as it is not defiened in the abstract class though its there in TestConcrete.
If I make the refernce type as interface Testif still I cannot call method2 even though the reference points to TestConcrete.
As far as I understand the method calls are made on the type of the object the reference points to and not on the class type of the reference. So why are these calls not possible ? Why can I call only those methods that are declared in the interface / abstrace class ?