why I need to define (impliment) interface?

Hello All,

What are differences between the following two statements

Sample sobj1 = new Sample();

ISample sobj2 = new Sample();

Sample is a class and ISample is an interface. I could access all members of the class Sample through sobj1 or sobj2, then why I have to define interface and use second statement

Please let me have the right reason

Many Thanks

k.senthilkumaran



Answer this question

why I need to define (impliment) interface?