Ejemplo n.º 1
0
        public object Clone()
        {
            Emloyee newEmployee = (Emloyee)this.MemberwiseClone();

            newEmployee.Room = new Room(Room.Number);
            return(newEmployee);
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            Emloyee Kovacs = new Emloyee(200, "archer", "Béla", 1995);

            Kovacs.Room = new Room(111);
            Emloyee Kovacs2 = (Emloyee)Kovacs.Clone();

            Kovacs2.Room.Number = 112;
            Console.WriteLine(Kovacs.ToString());
            Console.WriteLine(Kovacs2.ToString());
            Console.ReadKey();
        }