using System.Collections.Generic;
using System.Threading.Tasks;
namespace IDataTypeeeeeeeeeee
public interface IDataType
object Add(object other);
void SetVal(object other);
public interface IDataType<T> where T : IDataType, new()
class IntegerDataType : IDataType
public int Data { get; set; }
public object Add(object other)
int o = ((IntegerDataType)other).Data;
public void SetVal(object other)
class DoubleDataType : IDataType
public double Data { get; set; }
public object Add(object other)
double o = ((DoubleDataType)other).Data;
public void SetVal(object other)
public class DataType<T> : IDataType<T> where T : IDataType, new()
public DataType(IDataType item)
object o = _item.Add(other);
public static void Main(string[] args)
DoubleDataType item3 = new DoubleDataType();
DoubleDataType item4 = new DoubleDataType();
DataType<DoubleDataType> l2 = new DataType<DoubleDataType>(item3);
DoubleDataType sum2 = l2.Add(item4);