using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace GenericAddition
{
class Program
{
static void Main(string[] args)
{
}
}
class Calculator<T>
{
T num1, num2, res;
public T Num1
{
set
{
this.num1 = value;
}
}
public T Num2
{
set
{
this.num2 = value;
}
}
public T Add()
{
this.res = this.Num1 + this.Num2;
return this.res;
}
/* public static Calculator<T> operator +(Calculator<T> a,
Calculator<T> b)
{
Calculator<T> x = new Calculator<T>();
x.res = a.Num1 + a.Num2;
return x;
}*/
}
}
Sir this is a piece of code in which i want to perform the addition
but not possible to perform.
the error is can not perform the addition on T type variable
i have a hint that the soln is to overload the binary operator + but i
am not able to perform it....
Please Solve it......
Thanks.............