static void Main()
 {
     Person a = new Person("Pesho", 7);
     Person b = new Person("Gosho", 15, "*****@*****.**");
     Console.WriteLine(a);
     Console.WriteLine(b);
 }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            Person p1 = new Person("Johny Kitaeca", 25);
            Person p2= new Person("Beihui Ahmed", 34, "*****@*****.**");

            Console.WriteLine(p1);
            Console.WriteLine(p2);
        }
        static void Main(string[] args)
        {
            Person first = new Person(30, "Mike", "*****@*****.**");
            Console.WriteLine(first);

            Person second = new Person(40, "Jimmy", "*****@*****.**");
            Console.WriteLine(second);
        }
        static void Main(string[] args)
        {
            Person c = new Person();
            c.Name = Console.ReadLine();
            c.Age = int.Parse(Console.ReadLine());
            c.Email = Console.ReadLine();

            Console.WriteLine(c);

            //a.Name = ""; //This will throw exception:
            //b.Age = 102; //This will throw exception:
            //b.Email = "Q.AngelovAtabv.bg"; //This will throw exception:
        }
Ejemplo n.º 5
0
Archivo: Persons.cs Proyecto: Gab42/OOP
 static void Main(string[] args)
 {
     try
        {
         Person p1 = new Person("John", 99);
         Console.WriteLine(p1.ToString());
         Person p2 = new Person("Ana", 21, "*****@*****.**");
         p2.Age = 101;
         Console.WriteLine(p2.ToString());
     }
     catch (ArgumentOutOfRangeException e)
     {
         Console.WriteLine(e.Message);
     }
     catch (ArgumentException e)
     {
         Console.WriteLine(e.Message);
     }
 }