Example #1
0
 public Bike(FrontWheel fw, RearWheel rw, Brakes brk, Bell bl)
 {
     parts.Add(fw);
     parts.Add(rw);
     parts.Add(brk);
     parts.Add(bl);
 }
Example #2
0
 public void visit(FrontWheel fw)
 {
     if (fw._tireFlat)
     {
         Console.WriteLine("Front tire fixed and pumped\n");
         fw._tireFlat = false;
     }
     else
     {
         Console.WriteLine($"Nothing is wrong with front wheel\n");
     }
 }
Example #3
0
        static void Main(string[] args)
        {
            FrontWheel fw   = new FrontWheel();
            RearWheel  rw   = new RearWheel();
            Brakes     brk  = new Brakes();
            Bell       bl   = new Bell();
            Bike       bike = new Bike(fw, rw, brk, bl);

            MaintenancePerformer mp = new MaintenancePerformer();

            Console.WriteLine("Is front tire flat?: {0}\n", fw._tireFlat);

            bike.accept(mp);

            Console.WriteLine("Is front tire flat?: {0}", fw._tireFlat);
        }