Re: Please help me learn STL
Quote:
Originally Posted by
terminalXXX
That was a short quote from someone. But I have a hard time understanding his words and how to write a piece of code as to exemplify what he says.
for example
Code:
template<typename T>
class MyList:public std::list<T>
{
};
Why is this supposed to be unsafe ?
Thank you
Code:
int main()
{
std::list<int> *pList = new MyList<int>;
delete pList;
}
The behaviour is undefined, since std::list<int> has no virtual destructor.
Regards,
Paul McKenzie