Class ... has no member.... What?

So I'll assume you don't have an answer to my splitting linked list problem. Okay. Thanks for trying. But this is really starting to get on my nerves.

Derived class unorderedListType inherits base class linkedListType. Class linkedListType has a member called dividedAt. Defined like this:
1
2
3
4
5
template <class Type>
class linkedListType {
public:
       ...(other functions)....
       void dividedAt(Type& div, linkedListType<Type> &otherList);


And the definition of the function, in case it's important:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
template <class Type>
void linkedListType<Type>::dividedAt(Type& div, linkedListType<Type> &otherList)
{   
    nodeType<Type>* trailer;
    nodeType<Type>* current;

    if (first == NULL)  
        cout << "There's nothing in this list.\n";
    else if (first->link == NULL)  
        current->link = NULL;
    else
    {
        current = first;

        if (current->info != div)    
           { trailer = current;
            current = current->link;}
        else if (current->info == div)
           trailer->link = NULL; 
           current->info = otherList.first;
    } 
} 


Now to show the derived class:
1
2
3
4
5
6
#include "linkedlistthings.h"
  
using namespace std;

template <class Type>
class unorderedLinkedList: public linkedListType<Type>

It includes the header file of the base class and shows public inheritance of the base class.

When I run a program, declaring a list of type unorderedLinkedList using this function, this error comes up:
'class unorderedLinkedList<int>' has no member named 'dividedAt'
Well, yeah, it's technically a public member of the base class. Anybody know why it's not being recognized as a member of the class? Thanks.
Any code inside unorderedLinkedList<> that directly references members of the templated base
class must explicitly qualify the members. For example

1
2
3
4
5
6
7
8
9
10
11
12
template< typename T >
class Base {
    public:
        T foo;
};

template< typename T >
class Derived : public Base< T > {
    public:
        void print() const
             { std::cout << Base::foo << std::endl; } // Note explicit qualification of foo
};

Thanks for the response, but it's not a function in the derived class that's trying to access a base function. It's an object of the derived class in the driver (main), although more accurately, it's a templated function declared outside main and called within main (since main can't be templated); it can access other members of the base class just fine.
Topic archived. No new replies allowed.