Templates error, inheritance

Hello. I have a problem in one of my projects and can't seem to locate it. Can someone please help?

I have these two classes
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
template <class TE>
class IAddress {
protected:
    TE* info;
    IAddress<TE>* next;
public:
    IAddress() {
        info = 0;
	next = 0;
    }

    void setInfo(TE* e) {
	info = e->clone();
    }

    void setNext(IAddress* n) {
	next = n;
    }

    TE* getInfo() {
	return info;
    }

    IAddress<TE>* getNext() {
	return next;
    }
    
    virtual bool equals(IAddress<TE>*) = 0;
};

template<class TE> 
class SNode: public IAddress<TE> {
public:
    SNode() {
        info = 0;
        next = 0;
    }

    SNode(TE*, SNode<TE>*) {
	info = e->clone();
	next = n;
    }

    SNode(const SNode<TE> &) {
	info = n.info->clone();
	next = n.next;
    }

    ~SNode() {
	if (info) {
            delete info;
	    info = 0;
	}
    }

    SNode<TE>& operator=(const SNode<TE> &n) {
	if (this != &n) {
            info = n.info->clone();
	    next = n.next;
	}
	return *this;
    }

    bool equals(IAddress<TE>* e) {
	if (next == e->getNext() && info->equals(e->getInfo()))
            return true;
	return false;
    }
};
:

My problem is that I cannot see "info" and "next" in SNode. Weren't those supposed to be inherited? Am I doing something illegal?
You have to explicitly qualify them.

IAddress::info, etc.

(Yes, this seems odd, but it is required by the standard).
Thank you.

I wrote it as IAddress<TE>::info and now it works. Unfortunetly, I'm still having an issue with this... Isn't it a bit of an overkill to qualify them as such, if you have multiple templates?

For example, I have two more classes, besides those from the first post:

1
2
3
4
5
6
7
8
9
10
template<class T, class TE>
class IContainer { 
    T* head;
    //I think the rest of the code is not relevant
};

template <class TE> 
class ListContainer : public IContainer<SNode<TE>, TE> {
    //more irrelevant code
};


In this case, if I want to access the member "head" in ListContainer (inherited from IContainer), I would have to use IContainer<SNode<TE>, TE>::head, every time?

Is this the only way to do it? Or am I using a flawed design?
Topic archived. No new replies allowed.