Aug 05
2009
Interfészhiearchia
Filed Under (Uncategorized) by nameless on 05-08-2009
Interfészhiearchia tervezése:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace InterfaceHierarchy
{
public interface IDrawable
{
void Draw();
}
public interface Iprintable : IDrawable
{
void Print();
}
public interface IRenderToMemory : Iprintable
{
void Render();
}
public class SuperShape : IRenderToMemory
{
public void Draw()
{
Console.WriteLine("Drawing...");
}
public void Print()
{
Console.WriteLine("Printig...");
}
public void Render()
{
Console.WriteLine("Rendering...");
}
}
public class TwoShape : Iprintable
{
public void Draw()
{
Console.WriteLine("Drawing...");
}
public void Print()
{
Console.WriteLine("Printig...");
}
}
class Program
{
static void Main(string[] args)
{
Console.WriteLine("**********SUPERSHAPE*************");
var myShape = new SuperShape();
myShape.Draw();
myShape.Print();
myShape.Render();
Console.ReadKey();
Console.WriteLine("\n\n************TwoShape*************");
var myTwoShape = new TwoShape();
myTwoShape.Draw();
myTwoShape.Print();
Console.ReadKey();
}
}
}
