解释器模式

class Context

{

public string Input { get; set; }

}

abstract class Explainer

{

public abstract void Explain(Context context);

}

class FinalExplainer : Explainer

{

public override void Explain(Context context)

{

Console.WriteLine("Final Explain:{0}", context);

}

}

class UNFinalExplainer : Explainer

{

public override void Explain(Context context)

{

Console.WriteLine("UNFinal Explain:{0}", context);

}

}

你可能感兴趣的:(模式)