Hi all,
I got a basic doubt when to use interfaces or do we really want to use it. I will give a small example to expalin my doubt.
I have a Interface ISample which contains 2 methods A and B. I write a class ClsSample to implement this Interface. In that class I have to give implementaion to methods A and B.
so I will use this Interface by saying
ISample isample = new ClsSample();
isample.A();
isample.B();
Instead I can very well directly call the ClsSample class
ClsSample csample = new ClsSample();
isample.A();
isample.B();
So if I have defined this A and B method directly in the ClsSample class I don't need a Interface at all here. So I am really confused when I should use a Interface
Can anyone please tell me a thumb rule when to use a Interface.