Method interface -- list
OOP
template< class E > class nil : public list<E> {\c{\fbox{}}
public: nil() {} bool empty() { return 1; } E head() { require( false ); return E(); } list<E>* tail() { require( 0 ); return 0; } bool operator==(list<E>* m) { return m->empty(); } }; template< class E > class cons : public list<E> {\c{\fbox{}}
public: cons(E e, list<E>* l) : _e(e), next(l) {} ~cons() { delete next; } bool empty() { return 0; } E head() { return _e; } list<E>* tail() { return next; } bool operator==(list<E>* m); protected: E _e; list<E>* next; };