Ejemplo n.º 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);
    }
Ejemplo n.º 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);
    }
Ejemplo n.º 3
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();
    }