using System.Collections;
using System;
public class Counter<T>
{
private int pivot = 0;
private readonly int arraySize = 256;
private bool startCheck = false;
T[] baskets;
public T Count
{
get
{
return baskets[pivot];
}
}
public void CountPlus(T plusValue)
{
if(!startCheck)
{
startCheck = true;
baskets[pivot] = plusValue;
}
else
{
int previousPivot = pivot;
pivot++;
if( previousPivot == arraySize - 1 )
{
pivot = 0;
}
checked
{
try
{
baskets[pivot] = baskets[previousPivot] + plusValue;
}
catch(OverflowException ofe)
{
Debug.Log("=*=*=*=*=*=*=*=*= OverflowException =*=*=*=*=*=*=*=*=*=");
}
}
}
}
}
Hello~
I want to run this code but i have got an error message
error CS0019: Operator '+' cannot be applied to operands of type 'T' and 'T'
How do I solve this error?