Best way to "redefine" a std class

From: Nafai (nafai3000_at_yahoo.es)
Date: 12/07/04


Date: Tue, 07 Dec 2004 11:23:24 GMT

Hello I want to define a class myList, which is the same that std::list
except from:
- insert (I want to redefine it)
- elements can only be consulted or deleted but not modified.
- I want

Which is the best way to do that?:

1.
template <typename T> myList : public list<T> {
public:
   insert(...) { ... }
   ...
   // what about iterators?
};

OR

2.

template <typename T> myList {
private:
    list<T> theList;
public:
    // all the methos of list addapted to myList
    // i.e.:
    int size() {return theList.size(); }
    ...
    // what about iterators?
};

 



Relevant Pages