Jason
Jason

Reputation: 51

Templated Priority Queue inheriting from templated Heap

I'm trying to write a priority queue for my programming class but continue to get the following errors: PriorityQueue.cpp:7:1: error: ‘PriorityQueue::PriorityQueue’ names the constructor, not the type PriorityQueue.cpp:7:1: error: and ‘PriorityQueue’ has no template constructors

I've been at it for several hours now and have no idea whats wrong. Here is the code it is referring to:

template < typename DataType, typename KeyType, typename Comparator >
PriorityQueue<DataType,KeyType,Comparator>
    ::PriorityQueue<DataType,KeyType,Comparator>( int maxNumber )
        : Heap<DataType,KeyType,Comparator>( int maxNumber )
{

}

Upvotes: 0

Views: 174

Answers (1)

Surt
Surt

Reputation: 16099

Try this

template < typename DataType, typename KeyType, typename Comparator >
PriorityQueue<DataType,KeyType,Comparator>
    ::PriorityQueue( int maxNumber ) // <-- removed unneeded template parameter
        : Heap<DataType,KeyType,Comparator>( maxNumber ) // <--- maxNumber should be a parameter to the base class, not a definition.
{

}

Upvotes: 1

Related Questions