MessageModel
using System;
using System.Collections.Generic;
using System.Text;
namespace Pattern.Visitor
{
/**//// <summary>
/// Message實體類
/// </summary>
public class MessageModel
{
/**//// <summary>
/// 構造函數
/// </summary>
/// <param name="msg">Message內容</param>
/// <param name="pt">Message發布時間</param>
public MessageModel(string msg, DateTime pt)
{
this._message = msg;
this._publishTime = pt;
}
private string _message;
/**//// <summary>
/// Message內容
/// </summary>
public string Message
{
get { return _message; }
set { _message = value; }
}
private DateTime _publishTime;
/**//// <summary>
/// Message發布時間
/// </summary>
public DateTime PublishTime
{
get { return _publishTime; }
set { _publishTime = value; }
}
}
}
AbstractElement
using System;
using System.Collections.Generic;
using System.Text;
namespace Pattern.Visitor
{
/**//// <summary>
/// 抽象元素(Element)
/// </summary>
public abstract class AbstractElement
{
/**//// <summary>
/// 執行抽象訪問者的Visit()方法(從而執行抽象元素的方法)
/// </summary>
/// <param name="abstractVisitor">抽象訪問者</param>
/// <returns></returns>
public abstract string Accept(AbstractVisitor abstractVisitor);
}
}