using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace SimpleFactorMode
{
public class Program
{
public static void Main(string[] args)
{
Console.WriteLine("请问您需要生产什么样的笔记本?");
string notebookType = Console.ReadLine();
NoteBook nb = GetNoteBook(notebookType.ToUpper());
nb.SaySelf();
Console.ReadKey();
}
public static NoteBook GetNoteBook(string brand)
{
NoteBook nb = null;
switch (brand)
{
case "LENOVE":
nb = new Lenovo();
break;
case "ACER":
nb = new Acer();
break;
case "DELL":
nb = new Dell();
break;
case "IBM":
nb = new IBM();
break;
default: break;
}
return nb;
}
}
public class Computer
{
private MobileProduct mobileP;
public MobileProduct MobileP
{
get { return mobileP; }
set { mobileP = value; }
}
public void CRead()
{
MobileP.Read();
}
public void CWrite()
{
MobileP.Write();
}
}
public abstract class NoteBook
{
public abstract void SaySelf();
}
public class IBM:NoteBook
{
public override void SaySelf()
{
Console.WriteLine("我是IBM笔记本");
}
}
public class Lenovo:NoteBook
{
public override void SaySelf()
{
Console.WriteLine("我是Lenove笔记本");
}
}
public class Acer:NoteBook
{
public override void SaySelf()
{
Console.WriteLine("我是Acer笔记本");
}
}
public class Dell:NoteBook
{
public override void SaySelf()
{
Console.WriteLine("我是Dell笔记本");
}
}