Problem encountered in writing a class which extends QList

Jens Zurheide jens.zurheide at
Sat Mar 2 15:35:50 GMT 2002

Saturday 02 March 2002 05:36 Dung Patrick
>I need a new Class which extends QList. I have the following code but get
> error:
QList is a template class. If you do not know what this is a good book 
about C++ might help because this is an advanced feature of the programming 
language C++ and can not be explained in a short posting. A very tearse 
explanation is: this list can become a list holding any type you want.
>#ifndef RULE_H
>#define RULE_H
>#include <qlist.h>
If you want Rule to be as generic as QList you should write something like 
template< typename T >
  class Rule : public QList<T> {
  public :
    virtual ~Rule();
>class Rule : public QList {
>#include "rule.h"
template< typename T>
template< typename T>
and somewhere else

Rule<type_of_what_you_want> r;

However if you don't want to be Rule as generic as QList but a list to a 
specific data type you might want to declare your class like:

class Rule : public QList<whatever_type_you_want> {


Hope this helps.


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

More information about the KDevelop mailing list