using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Interface_Example
{
public interface IEditPicture
{
void Paint(string ID);
}
public interface IEditImage:IEditPicture
{
//This will hide the method of IEditPicture's
new void Paint(string ID);
}
public interface IDrawing : IEditPicture
{
//Bydefault this will hide the IEditPicture's Method
void Paint(string ID);
}
public class Studio : IEditImage,IDrawing
{
public void Paint(string ID)
{
Console.WriteLine("Paint Method of {0}",ID );
}
}
public class Bollywod :Studio
{
//This will use internally New keyword and hide the method of Studio Class.
public void Paint(string ID)
{
Console.WriteLine("Paint Method of {0}", ID);
}
}
class Program
{
static void Main(string[] args)
{
Studio sd = new Studio();
((IEditImage)sd).Paint("IEditImage");
((IDrawing)sd).Paint("IDrawing");
((IEditPicture)sd).Paint("IEditPicture");
//This will call method of Studio Class
sd.Paint("Class Studio");
Bollywod bd = new Bollywod();
//This will call method of Bollywod Class
bd.Paint("Bollywod");
Console.Read();
}
}
}
No comments:
Post a Comment