Created
April 27, 2012 07:34
-
-
Save tnngo2/2506990 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
namespace Theory8 | |
{ | |
interface IMaths<T> | |
{ | |
T Addition(T valOne, T valTwo); | |
T Subtraction(T valOne, T valTwo); | |
} | |
class Numbers: IMaths<int> | |
{ | |
public int Addition(int valOne, int valTwo) | |
{ | |
return valOne + valTwo; | |
} | |
public int Subtraction(int valOne, int valTwo) | |
{ | |
if (valOne > valTwo) | |
{ | |
return (valOne - valTwo); | |
} | |
else | |
{ | |
return (valTwo - valOne); | |
} | |
} | |
static void Main(string[] args) | |
{ | |
int numOne = 23; | |
int numTwo = 45; | |
Numbers objInterface = new Numbers(); | |
Console.WriteLine("Addition of two integer value is: "); | |
Console.WriteLine(objInterface.Addition(numOne, numTwo)); | |
Console.WriteLine("Subtraction of two integer value is: "); | |
Console.WriteLine(objInterface.Subtraction(numOne, numTwo)); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment