Skip to content

Instantly share code, notes, and snippets.

@kosanmil kosanmil/Unit.cs
Last active Feb 2, 2019

Embed
What would you like to do?
Snippet containing implementation of Unit, ProcessUnit and AgentUnit
public abstract class Unit
{
public string Name;
public State State;
public abstract void AcceptVisitor(IVisitor visitor);
}
public class ProcessUnit : Unit
{
public IEnumerable<Unit> ChildUnits;
public override void AcceptVisitor(IVisitor visitor)
{
visitor.VisitProcessUnit(this);
}
}
public class AgentUnit : Unit
{
public void SendCommand(Command command)
{
//Implementation ommited due to simplicity of the example
}
public override void AcceptVisitor(IVisitor visitor)
{
visitor.VisitAgentUnit(this);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.