static void Main(string[] args)
        {
            RoadSign SpeedLimit60Km = new RoadSign("Speed limit is 60 km. h", "You cann't move with a speed exceeding 60 km. h", true);

            Console.WriteLine(SpeedLimit60Km.ToString());
            Console.WriteLine(SpeedLimit60Km.Action());

            RoadSign RoadClosed = new RoadSign("Road closed", "You cann't move by this road", false, "Cargo", "The sign applies only to cargo transport");

            Console.WriteLine(RoadClosed.ToString());
            Console.WriteLine(RoadClosed.Action());

            Semafor threeLightsSemafor = new Semafor("Semafor", "Vehicle travel is regulated depending on the color of the traffic light");

            Console.WriteLine(threeLightsSemafor.ToString());
            threeLightsSemafor.SwitchSemaforColor(5000);
        }
예제 #2
0
 public override string ToString()
 {
     if (trafficPermission == null)
     {
         return("It is additional sign: " + base.ToString());
     }
     else if (additionalSign == null)
     {
         return(base.ToString() + ", traffic permission is: " + trafficPermission);
     }
     else
     {
         return(base.ToString() + ", traffic permission is: " + trafficPermission + ", " + additionalSign.ToString());
     }
 }