Consider following scenario...
I want to develop the new IDE.
I will provide support for various databases like mySql, oracle etc.
Now, I will develop one interface
Interface MyInterface
{
public int Insert();
public List<object> Select();
}
I will give this Interface to DB providers for uniform implementation.
DB providers wouldn't allow me to see their implementation of those methods.
So to access those Methods what I need is to create the MyInterface's Reference and I will assign the object reference of the classes of DB provider.
This way I can access the methods of DB providers without seeing their internal implementation of code.
MySql DBProvider...
class MySqlDBProvider : : MyInterface
{
public override int Insert()
{
}
public override List<Object> Select()
{
}
}
Oracle DBProvider...
class OracleDBProvider : MyInterface
{
public override int Insert()
{
}
public override List<Object> Select()
{
}
}
Now what I need is...
using MyInterfaceNamespace;
using MySqlDBProviderNamespace;
public class MyClass
{
MyInterface MyIObj = new MySqlDBProvider();
MyIObj.Insert();
MyIObj.Select();
}
Hope You Understand the importance of this feature in this kind of scenario.
Hope This Help
-----------------
Pratik Bhuva