Ejemplo n.º 1
0
        //Two hundred degrees
        //That's why they call me Mister Fahrenheit
        //I'm traveling at the speed of light ♪
        static void Main(string[] args)
        {
            Humano Jotaro = new Humano(17, 82, "ORAORAORAORAORAORA", 1079252850, "StarPlatinum");

            Jotaro.Cresce(4);
            Jotaro.Nasce();
            Jotaro.Reproduz();
            Jotaro.Morre();
            Jotaro.Locomove();
            Jotaro.Comunica();
            Jotaro.Amamenta();

            Pato Donald = new Pato();

            Tubarão Red = new Tubarão();

            Peixe BacalhauAlSpaghetti = new Peixe();

            Cachorro Pluto = new Cachorro();

            Console.ReadKey();
        }
Ejemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            List <Animal> granja  = new List <Animal>();
            Galinha       g1      = new Galinha();
            Pato          p1      = new Pato();
            Gato          gatinho = new Gato();

            granja.Add(g1);
            granja.Add(p1);
            granja.Add(gatinho);

            foreach (Animal o in granja)
            {
                if (o is IOviparo)
                {
                    ((IOviparo)o).BotarOvo();
                }
                else
                {
                    MessageBox.Show("Gato não bota ovo.");
                }
            }
        }