コード例 #1
0
ファイル: Program.cs プロジェクト: PlVasilev/CSharp-In-Depth
        public Dude CopyDude()
        {
            Dude newPerson = new Dude();

            newPerson.Name      = Name;
            newPerson.LeftShoe  = LeftShoe;
            newPerson.RightShoe = RightShoe;
            return(newPerson);
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: PlVasilev/CSharp-In-Depth
        static void Main(string[] args)
        {
            Dude Bill = new Dude();

            Bill.Name           = "Bill";
            Bill.LeftShoe       = new Shoe();
            Bill.RightShoe      = new Shoe();
            Bill.LeftShoe.Color = Bill.RightShoe.Color = "Blue";
            Dude Ted = Bill.CopyDude();

            Ted.Name           = "Ted";
            Ted.LeftShoe.Color = Ted.RightShoe.Color = "Red";
            Console.WriteLine(Bill.ToString());
            Console.WriteLine(Ted.ToString());
        }