コード例 #1
0
ファイル: Program.cs プロジェクト: GrinevichAS/Mixin
        static void Main(string[] args)
        {
            var robot = new Dog { Greeting = "Bark Bark", Activity = "Relax" };
            robot.MixSay();
            robot.MixAct();

            var builder = new Human { Greeting = "Hello", Activity = "Hardworking"};
            builder.MixSay();
            builder.MixAct();

            Console.ReadKey();
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: alena-butkevich/OOP
        static void Main(string[] args)
        {
            try
            {
                Dog dog = new Dog();
                Dog labrador = new Labrador();

                dog.Feed();
                labrador.Feed();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            Console.ReadKey();
        }
コード例 #3
0
 public void Feed(Dog dog)
 {
     Console.WriteLine("{0} feeds {1}", name, dog.name);
 }