Exemple #1
0
        static void Main(string[] args)
        {
            #region ENUMERADOS

            Pessoa p1 = new Pessoa(12, "ola", Profissao.FUNC);

            #region Enumerados - ANALISAR

            Console.WriteLine("------ Enumerados Profissão ------");
            foreach (int p in Enum.GetValues(typeof(Profissao)))
            {
                Console.WriteLine(p + "= " + ((int)p).ToString());
            }

            foreach (string s in Enum.GetNames(typeof(Profissao)))
            {
                Console.WriteLine(s);
            }

            #endregion

            #endregion

            #region INDEXADORES



            LibExterna.Pessoas pes = new LibExterna.Pessoas();

            pes[0] = new LibExterna.Pessoa(12, "ola");

            #endregion


            #region HERANÇA I

            p1 = new Pessoa();

            Aluno a1 = new Aluno();     //1º new Pessoa - 2º new Aluno

            Aluno a2 = new Aluno(12, "ola", DateTime.Today, 12, "Morada");

            a2.GetNasc();       //devolve o Month

            p1.GetNasc();       //devolve Day

            Docente d1 = new Docente("ola", "Matematica");
            d1.GetNasc();       //Devolve Year


            Console.WriteLine("Data: " + a1.DataNasc);

            #endregion


            #region HERANÇA II

            BaseClass bc = new BaseClass("ola");

            Console.WriteLine("BC= " + bc.ToString());

            bc.Method1();
            bc.Method2();
            bc.Method3();

            DerivedClass dc = new DerivedClass("ole", 12);

            dc.Method1();
            dc.Method2();
            dc.Method3();
            dc.Method4();

            BaseClass dc1 = new DerivedClass();  //o que acontece?

            dc1.Method2();
            //DerivedClass xx = new BaseClass(); //o que acontece?

            #endregion

            Console.ReadKey();
        }