problem in extending QList (a template class)

Jens Zurheide jens.zurheide at gmx.de
Sun Mar 3 18:54:44 GMT 2002


Hi,

I found something interesting about templates for you at
http://www.codeguru.com/cpp/tic/tic0169.shtml There might be more of this 
stuff in the internet.

Sunday 03 March 2002 15:17 Dung Patrick
>Hi,
>
>I want to extend QList (say a class called Chain). QList itself is a
> template class. So, what's the method to extend a template class? Thank
> you for advance.
>
>
>Is the .h file like this:
>
>#include <qlist.h>
>template<class Chain> class Chain : public QList {
Should read like this:
template<class T> class Chain : public QList<T> {
Note: public inheritance translates into human language as "is a".
>
>public:
>
>        Chain(); //constructor
>        ~Chain(); //destructor
>};

template< class T>
  Chain<T>::Chain()
  {
  }
template< class T>
  Chain<T>::~Chain()
  {
  }

Note, that all member functions' definitions (where you define what the 
member function have to do) must be in header files for template classes.

Have fun,
Jens


-
to unsubscribe from this list send an email to kdevelop-request at kdevelop.org with the following body:
unsubscribe »your-email-address«



More information about the KDevelop mailing list