Beispiel #1
0
        public object Clone()
        {
            CarEngine      cloneEngine      = (CarEngine)engine.Clone();
            CarEngineSuper cloneEngineSuper = (CarEngineSuper)engineSuper.Clone();

            return(new Car(cloneEngine, cloneEngineSuper) as Car);
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            Logger logger = new Logger("log.txt");

            logger.Log("test1 message");
            logger.Log("test2 message");
            logger.Dispose();

            // variant 2  - dont need close stream
            using (Logger logger2 = new Logger("log.txt")) {
                logger2.Log("test11 message");
                logger2.Log("test22 message");
            }

            CarEngine      engine      = new CarEngine(22, 33);
            CarEngineSuper superEngine = new CarEngineSuper(224, 433);
            Car            car         = new Car(engine, superEngine);
            Car            car2        = (Car)car.Clone();
        }
Beispiel #3
0
 public Car(CarEngine e1, CarEngineSuper e2)
 {
     engine      = e1;
     engineSuper = e2;
 }