Пример #1
0
    public static void Main()
    {
        CMyMathClass objCMyMathClass = new CMyMathClass();
        IMyMath      objIMyMath = (IMyMath)objCMyMathClass;
        int          num1 = 75, num2 = 25, sum, sub;

        sum = objIMyMath.SumOfTwoIntegers(num1, num2);
        Console.WriteLine("Sum Of " + num1 + " And " + num2 + " Is " + sum);
        sub = objIMyMath.SubtractionOfTwoIntegers(num1, num2);
        Console.WriteLine("Subtraction Of " + num1 + " And " + num2 + " Is " + sub);
    }
Пример #2
0
    public static void Main()
    {
        CMyMathClass objCMyMathClass = new CMyMathClass();
        IMyMath      objIMyMath = (IMyMath)objCMyMathClass;    //explicit typecast
        int          num1 = 21, num2 = 11, sum, sub;

        sum = objIMyMath.SumOfTwoIntegers(num1, num2);
        Console.WriteLine("Sum Of " + num1 + " And" + num2 + "Is: " + sum);

        sub = objIMyMath.SubtractionOfTwoIntegers(num1, num2);
        Console.WriteLine("Subtraction Of " + num1 + " And" + num2 + "Is: " + sub);
    }
Пример #3
0
    public static void Main()
    {
        CMyMathClass objCMyMathClass = new CMyMathClass();
        //IMyMath objIMyMath = (IMyMath) objCMyMathClass;
        int num1 = 75, num2 = 25, res = 0;

        res = objCMyMathClass.SumOfTwoIntegers(num1, num2);
        Console.WriteLine("The Sum Of " + num1 + " and " + num2 + " is " + res);

        res = objCMyMathClass.SubtractionOfTwoIntegers(num1, num2);
        Console.WriteLine("The Subtraction Of " + num1 + " and " + num2 + " is " + res);
    }
Пример #4
0
    public static void Main()
    {
        CMyMathClass obj        = new CMyMathClass();
        IMyMath      objIMyMath = (IMyMath)obj;

        int num1 = 75, num2 = 45, sum, sub;

        sum = objIMyMath.SumOfTwoIntegers(num1, num2);
        Console.WriteLine("Sum of " + num1 + "and " + num2 + "is " + sum);
        sub = objIMyMath.SubtractionOfTwoIntegers(num1, num2);
        Console.WriteLine("Subtraction of " + num1 + "and " + num2 + "is " + sub);
        Console.ReadLine();
    }