Exemple #1
0
        static void Main(string[] args)
        {
            Adult adult = new Adult();
            adult.FName = Paul;
            adult.LName = Peter;
            Child child = new Child();
            child.FName = winta;
            child.LName = Samiel;

        Parent[] Names = new Parent[] {adult,child};
            foreach (Parent N in Names)
            {
                    N.Name();
            }

        }
Exemple #2
0
        public static void Main()
        {
            Adult adult = new Adult();
            Child child = new Child();

            adult.FirstName = "Rachel";
            adult.LastName  = "Green";

            child.FirstName = "Ross";
            child.LastName  = "Geller";

            Object[] objects = new object[2];
            objects[0] = new Adult()
            {
                FirstName = "Dami", LastName = "Lovato"
            };
            objects[1] = new Child()
            {
                FirstName = "Taylor", LastName = "Swift"
            };
        }