Exemplo n.º 1
0
        public static void objectsForOtherClassesInSameNameSpace()
        {
            Console.WriteLine("objectsForOtherClassesInSameNameSpace Method: ");
            Console.WriteLine("Uses Introduce method in Person class- ");
            //CREATE OBJECT FOR PERSON
            Person john = new Person()
            {
                Age = 20
            };

            john.FirstName = "John";
            john.LastName  = "Smith";
            john.Introduce();
            Console.WriteLine("John is currently {0} years old", john.Age);
            //calling incrementAge and MakeOld methods in Person class
            john.IncrementAge(john.Age);
            john.MakeOld(john);

            Console.WriteLine();

            Console.WriteLine("Uses Add method in Calculator class located in another folder of HelloWorld namespace- ");
            Calculator calculator = new Calculator();
            int        result     = calculator.Add(1, 2);

            Console.WriteLine(result);
        }