inheritance problem

this is my list.h (an ex. im following in my book)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
template<typename type>
class list {

private:
    struct node{
    type data;
    node *previous;
    node *next;
};
    
public:
    class const_iterator{};
    class iterator : public const_iterator{};
    
public:
    list(){}
    list(const list & rhs){}
    ~list(){}
    const list & operator=(const list & rhs){}
    
    iterator begin(){
        return iterator(head->next);
    }
    
    const_iterator begin(){
        return const_iterator(head->next);
    }
    
    iterator end(){
        return iterator(tail);
    }
    
    const_iterator end() const{
        return const_iterator(tail);
    }
    
    int size() const{
        return theSize;
    }
    
    bool empty() const{
        return size()==0;
    }
    
    void clear(){
        while (!empty())
            pop_front();
    }
    
    type & front(){
        return *begin();
    }
    
    const type & front() const{
        return *begin();
    }
    
    type & back(){
        return *--end();
    }
    
    const type & back() const{
        return *--end();
    }
    
    void push_front(const type & x){
        insert(begin(), x);
    }
    
    void push_back(const type & x){
        insert( end(), x);
    }
    
    void pop_front(){
        erase(begin());
    }
    
    void pop_back(){
        erase(end());
    }
    
    iterator insert(iterator itr, const type & x){}
    iterator erase(iterator itr){}
    
private:
    int theSize;
    node *head;
    node *tail;
    
    void init(){}
    
};



this is my implementation that will not identify "type". it isnt finished just no use in continuing if i cant see the problem with that.


1
2
3
4
5
6
7
8
9
10
11
#include "List.h"

class const_iterator{
public:
    const_iterator() : current(NULL){}
    
    const type & operator*()const{
        return retrieve();
    }
    
};


i know the list.h is templated but the functions arent (this is the way its done in the book) are they just stupid for writing it this way or do they assume that i should know this and change it all. like they are talking about it like this is a functioning implementation when it isnt.
Topic archived. No new replies allowed.