コード例 #1
0
ファイル: Program.cs プロジェクト: zeeshantalib/C-Sharp
        static void Main(string[] args)
        {
            IColorable[] colorables = { new Animal(), new Wall() };


            foreach (IColorable item in colorables)
            {
                item.applyColor(ConsoleColor.Red);
            }



            Animal cat = new Animal();

            cat.speak();
            cat.walk();


            IColorable colorable = cat;

            IColorable colorable2 = new Animal();


            Organics org = cat;

            org.speak();
            org.walk();



            return;

            Student std = new Student();

            std[0]          = "math";
            std.subjects[0] = "science";


            Console.WriteLine(std.subjects[0]);


            Person per2 = new Person();



            IFillable fillable = new Student();

            fillable.fill(ConsoleColor.Red);

            IFillable[] fillables = { std, fillable };

            Person[] perons = { std, per2 };

            foreach (Person item in perons)
            {
                item.name();
            }



            Person per = std;

            per.speak();
            per.name();

            std.speak();
            std.name();
        }