Templates mate. Templates.
Code:
template <typename T> class MyArrayClass
{
public:
MyArrayClass( int arraySize );
private:
int size;
T* array;
} And below is how you could define a setItem method:
Code:
void dInt::setItem( int pos, T val )
{
if(pos <= size)
array[pos] = val;
} And so forth. But I warn you, setting up a decent abstract array is hard

.
For example, what do you have to do to make this always work?
Try it if you like a challenge

.