Is it possible to make it ?
For instance, consider the following code snippet:
#include <iostream>
using namespace std;
template <typename T> class A {
public:
void print() {
T var;
cout << sizeof(var) << endl;
}
};
int main() {
A<int>* c = new A<int>;
c->print();
A<char>* d = reinterpret_cast<A<char>*>(c);
d->print();
}
Is there a "danger" with this kind of pratice ?