Hi,

I want to make a subclass of QList for any type T.

Since I'm not very familiar with templates inheriting, I try to make a mirror copy of QList first.

This is my my_list.h header file
Qt Code:
  1. template <class T>
  2. class MyList : public QList<T>
  3. {
  4. public:
  5. MyList() : QList() {}
  6. ~MyList() : ~QList() {}
  7. };
To copy to clipboard, switch view to plain text mode 

I try to use MyList as a QList in the main program, but the code cannot be compiled.
The error is :
Qt Code:
  1. error C2059: syntax error : '~' while compiling class template member function 'MyList<T>::~MyList(void)' with [ T = MyObject *]
  2. see reference to class template instantiation 'MyList<T>' being compiled with [ T = MyObject *]
To copy to clipboard, switch view to plain text mode 

How should I fix the error to create a template works exactly as QList?
Thanks in advance.