解释器模式
1 它的意思是解释,不过没看出来和解释有什么太大的关联。结构的特点是,一些继承类的继承方法,通过传入的其他继承类来实现。一个解释基类,一些继承类(供其他使用),一些继承类(使用其他继承类)
2 自己的案例没有写完,,
public interface Expression
{
bool Interpret(string inputStr);
}
public class NounExpression : Expression
{
public bool Interpret(string inputStr)
{
if (inputStr.Contains(".noun"))
{
return true;
}
return false;
}
}
1315

被折叠的 条评论
为什么被折叠?



