Hi All,
Could anyone please provide any link or explaination of why we create interface reference variable and assign the object of the implemented class to that(Line No.17).Here is the sample i got from msdn.
- interface ISampleInterface
- {
- void SampleMethod();
- }
-
- class ImplementationClass : ISampleInterface
- {
-
- void ISampleInterface.SampleMethod()
- {
-
- }
-
- static void Main()
- {
-
- ISampleInterface obj = new ImplementationClass();
-
-
- obj.SampleMethod();
- }
- }
Thanks
Regards
Rajeev