Beispiel #1
0
        static void Main(string[] args)
        {
            PosicaoClass pos1 = new PosicaoClass();

            pos1.x = 10;
            pos1.y = 20;

            PosicaoStruct pos2 = new PosicaoStruct();

            pos2.x = 30;
            pos2.y = 40;

            PosicaoStruct pos3 = pos2; //value types, so, it's a copy.

            pos3.y = 50;               //so this change has not changed the pos2.y

            FormasPgto formaPgto = FormasPgto.Boleto;
            Role       role      = Role.Arquiteto;
            Color      cor       = Color.Blue;



            Console.WriteLine(formaPgto);
            Console.WriteLine(role);
            Console.WriteLine(cor);
            Console.WriteLine(pos1);
            Console.WriteLine(pos2);
            Console.WriteLine(pos3);
            Console.ReadLine();
        }
        static void Main(string[] args)
        {
            PosicaoClass pos1 = new PosicaoClass();

            pos1.X = 10;
            pos1.Y = 20;
            PosicaoStruct pos2 = new PosicaoStruct();

            pos2.X = 30;
            pos2.Y = 40;
            PosicaoStruct pos3 = pos2; //Value type: cópia

            pos3.Y = 50;


            FormaPagto formaPagto = FormaPagto.Boleto;
            Role       role       = Role.Arquiteto;
            Color      cor        = Color.Blue;

            Console.WriteLine(role);
            Console.WriteLine(formaPagto);
            Console.WriteLine(cor);


            Console.WriteLine(pos1);
            Console.WriteLine(pos2);
            Console.WriteLine(pos3);

            Console.ReadLine();
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            PosicaoClass pos1 = new PosicaoClass();

            pos1.X = 10;
            pos1.Y = 20;

            PosicaoStruct pos2 = new PosicaoStruct();

            pos2.X = 30;
            pos2.Y = 40;
            PosicaoStruct pos3 = pos2;// value types - copia

            pos3.Y = 50;
            FormasPagto formaPagto = FormasPagto.Boleto;
            Role        role       = Role.Developer;
            Color       color      = Color.Red;

            Console.WriteLine(color);
            Console.WriteLine(role);
            Console.WriteLine(formaPagto);
            Console.WriteLine(pos1);
            Console.WriteLine(pos2.ToString());
            Console.WriteLine(pos3.ToString());
            Console.ReadLine();
        }
Beispiel #4
0
        private static void ChamarInstanciarPrintarClass()//instancia uma classe atraves de um ponteiro, devolvendo os valores das variaveis atribuidos da classe
        {
            PosicaoClass pos1 = new PosicaoClass();

            pos1.X = 10;
            pos1.Y = 20;

            Console.WriteLine(pos1);
            Console.ReadLine();
        }