So here is something I am writing just to get back into code and I can't find the flaw with it.
template<typename T>
class Array
{
public:
Array(unsigned arraySize):
data(0), size(arraySize)
{
if(size > 0)
data = new T[size];
}
~Array()
{
if(data) delete[] data;
}
void setValue(unsigned index, const T& value)
{
if(index < size)
data[index] = value;
}
T getValue(unsigned index) const
{
if(index < size)
return data[index];
else
return T();
}
private:
T* data;
unsigned size;
};
I think I just need a fresh set of eyes to help me out.