I'm making copy of template class that can contain pointer on object or pointer of derived class. I tried with allocation on heap but it continuously making object of main class, doesn't matter is it of derived or main class. How can I fix it. Code is huge, this is a part where I tried it:
template<typename T>
inline void Pair<T>::copy(const Pair& p) {
pointerAttribute1 = new T(*p.getFirst());//this is an object of main class in my main
pointerAttribute2 = new T(*p.getSecond());//this is an object of derived class in my main
}