public void Accept(Visitor visitor) { foreach (House house in houses) { house.Accept(visitor); } }
public override void Accept(Visitor visitor) { if (CheckTrolle(visitor)) { Console.WriteLine("Trolle don't entry in GirlsHouse!"); return; } visitor.VisitGirlsHouse(this); }
public abstract void Accept(Visitor visitor);
private static bool CheckTrolle(Visitor visitor) { return visitor is Trolle; }