Esempio n. 1
0
        static void Main(string[] args)
        {
            //creating a class
            example e = new example(2, "hi");

            e.printing();

            //out parameters
            int sum = AddSum(2, 3, 5, 1);

            Console.WriteLine("The value of sum with out parameter is " + sum);

            //reference type
            int x2 = 0;

            Adding(ref x2);
            Console.WriteLine("The value of ref is " + x2);

            //default parameters1
            int x3 = Adding1(2, 8);

            Console.WriteLine("The value for default params is " + x3);

            //default parameters2
            int x4 = Adding2(2, 2, z: 3);

            Console.WriteLine("The value for default params2 is " + x4);

            //inheritance
            FullTimeEmployee fe1 = new FullTimeEmployee();

            fe1.fName = "Joanna";
            fe1.lName = "Ruth";
            fe1.print();

            ContractEmployee c1 = new ContractEmployee();

            c1.fName = "J";
            c1.lName = "R";
            c1.print();

            Employee e1 = new FullTimeEmployee();

            e1.fName = "Jo";
            e1.lName = "Ru";
            e1.print();

            Employee e2 = new ContractEmployee();

            e2.fName = "Joey";
            e2.lName = "Ru";
            e2.print();

            Console.Read();
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            FullTimeEmployee FTE = new FullTimeEmployee();

            FTE.FirstName    = "Anwar";
            FTE.LastName     = "Ali";
            FTE.YearlySalary = 500000;
            FTE.PrintFullName();

            PartTimeEmloyee PTE = new PartTimeEmloyee();

            PTE.FirstName = "Adem";
            PTE.LastName  = "Kedem";
            PTE.PrintFullName();
            PTE.HourlySalary = 175000;
        }