So in the header file of my derived class OrderedList I am inheriting some of the functionality of my previously created List class by telling the compiler to use a base class method by using List<DataType>::examplefunction;
. All the functions which are not being overrided and that are being declared in the aforementioned way are private members of OrderedList.
So when I run my program, I obtain the error in Microsoft Visual Studio of:
error C2248: 'OrderedList::examplefunction' : cannot access private member declared in class 'OrderedList'
examplefunction is public in the base class List.
Here is a concrete example of what I am working with:
In OrderedList.h,
private:
using List<DataType>::remove;
In List.h,
public:
void remove () throw ( logic_error );
And where remove is in List.cpp as,
void List<DataType>::remove () throw ( logic_error )
{ // Do some operations//
}
Also the declaration in my OrderedList header file is like this:
#include "List.cpp"
template < typename DataType, typename KeyType >
class OrderedList : public List<DataType>
If anyone could enlighten me to what is causing the issue that would be much appreciated.