Hello, I'm currently working on a lab for my programming class, I'm stuck on this repetitive error.
SortedListLinkedDriver.cpp: In function 'int main()':
SortedListLinkedDriver.cpp:41:58: error: no matching function for call to 'CSC2110::SortedListLinked<CSC2110::CD>::SortedListLinked()'
SortedListLinked<CD>* list = new SortedListLinked<CD>();
#include <iostream>
usingnamespace std;
class SortedListLinked
{
private:
NextNode<T>* head;
int sze;
NextNode<T>** findAdd(T* item);
NextNode<T>** findRemove(T* item);
//this is how to declare a function pointer using templates
int (*compare_items) (T* item_1, T* item_2);
public:
//this is how to accept a function pointer as a parameter
SortedListLinked(int (*comp_items) (T* item_1, T* item_2));
~SortedListLinked();
bool isEmpty();
int size();
void add(T* item);
void remove(T* item); //normally, we would use void remove(String* search_key) here
T* get(int index); //normally, we would use T* get(String* search_key)
ListLinkedIterator<T>* iterator();
}
SortedListLinked(int (*comp_items) (T* item_1, T* item_2)); you said that a sorted_list needs a comparison function. SortedListLinked<CD>* list = new SortedListLinked<CD>(); you did not provide a comparison function, so can't construct the list.