using System;
namespace MyApp
{
class Program
{
static void Main()
{
Language csharp=new CSharp("CSharp");
OS win2k8 = new Windows("win2k8", csharp);
win2k8.Run();
Console.ReadKey();
}
}
interface IRun
{
void Run();
}
abstract class Language:IRun
{
public string Name { get; set; }
public Language(string name)
{
Name = name;
}
public abstract void Run();
}
class CSharp : Language
{
public CSharp(string name)
: base(name)
{ }
public override void Run()
{
Console.WriteLine("C# app is running now...");
Console.WriteLine("Language:{0}", Name);
}
}
class JAVA : Language
{
public JAVA(string name)
: base(name)
{ }
public override void Run()
{
Console.WriteLine("JAVA app is running now...");
Console.WriteLine("Language:{0}",Name);
}
}
abstract class OS:IRun
{
public string OSName { get; set; }
public Language TheLanguage { get; set; }
public OS(string name, Language language)
{
OSName = name;
TheLanguage = language;
}
public void Run()
{
TheLanguage.Run();
}
}
class Windows : OS
{
public Windows(string name, Language language)
: base(name, language)
{ }
}
}