N
Nafai
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?
};
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?
};