I have some code like this:
template<class T> class classA
{
public:
    classA(uint32_t max) : numElements(max)
    {
        data = new T[numElements];
    }
    ~classA() {delete[] data;}
    uint32_t size()
    {
        return numElements;
    }
    T *data;
private:
    const int numElements;
};
class classB
{
public:
    classB(uint8_t* adress) : ptr(adress){}
    void someFunction(classA<class T>* x)
    {
        uint8_t size = sizeof(T);
        /*
        do some stuff with the type size of T
        */
        T* ptr1 = (T*)ptr; // create new pointer with same adress as ptr but different data type
        /*
        write some data from ptr1[i] to x->A[i]
        */
    }
private:
    uint8_t* ptr;
};
int main()
{
    classB B(/*some memory adress*/);
    classA<uint16_t> A(5)
    B.someFunction(&A);
}
This code (it is very simplified here) should make it possible for an object of classB to write data starting from a specific memory adress to the data field of a classA object no matter which type the data array inside classA has.
As written, the compiler gives some errors:
- invalid application of 'sizeof' to incomplete type 'T' 
- invalid use of incomplete type 'class T' (because of the pointer stuff in someFunction) 
- invalid arguments ' (because of the call of B.someFunction(&A))
- no matching function for call to 'classB::someFunction(classA<>*)'
My questions are:
- What do I have to change in order to reach the following functionality? The pointer given to - someFunctionshould be allowed to have an arbitrary data type and the operations shown above should work without incomplete type errors.
- What is the correct synthax to call someFunction in main? 
I've tried different things already but nothing helped :-(
 
    