标签:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace 模板模式
{
public abstract class CarProces
{
public abstract void handler1();
public abstract void handler2();
public void handler()
{
handler1();
handler2();
}
}
public class BusProcess : CarProces
{
public override void handler1()
{
Console.WriteLine("car process1");
}
public override void handler2()
{
Console.WriteLine("car process2");
}
}
public class JeepProcess : CarProces
{
public override void handler1()
{
Console.WriteLine("jeep process1");
}
public override void handler2()
{
Console.WriteLine("jeep process2");
}
}
class Program
{
static void Main(string[] args)
{
CarProces c1=new BusProcess();
CarProces c2=new JeepProcess();
c1.handler();
Console.WriteLine("--------------------");
c2.handler();
Console.ReadKey();
}
}
}
标签:
原文地址:http://www.cnblogs.com/kexb/p/4525244.html