Hello Friends,
Actually in c# we can Create object for an Interface.
Example:
Interface Myinterface
{
public void MyMethod();
}
public class MyBaseClass : Myinterface
{
public virtual void MyMethod()
{
MessageBox.Show("MyBaseClass");
}
}
In Some other Class you can Create object for the Interface as follows,
MyBaseClass objMyBaseClass=new MyBaseClass();
Myinterface objMyinterface = (Myinterface)objMyBaseClass;
Actually in c# we can Create object for an Interface.
Example:
Interface Myinterface
{
public void MyMethod();
}
public class MyBaseClass : Myinterface
{
public virtual void MyMethod()
{
MessageBox.Show("MyBaseClass");
}
}
In Some other Class you can Create object for the Interface as follows,
MyBaseClass objMyBaseClass=new MyBaseClass();
Myinterface objMyinterface = (Myinterface)objMyBaseClass;