Question: c++: giving a header file including struct node and a linkedlist class, complete bool Insert( T* obj ) : Insert an object in the list
c++: giving a header file including struct node and a linkedlist class,
complete bool Insert( T* obj ) : Insert an object in the list in the correct place. Return true or false depending on whether the insert was successful. Duplicates of an object are not allowed and should return false. Note that a pointer to the object is passed in but the Insert should create a copy of the object to keep in the list. The item could be an object, string, int, etc, assume that the operater overload already done if the passed in object type is a class.

Here's the code that I wrote, it contains many errors because I don't know how to get the value of Node data while it has to be a pointer according to my professor. I need to compare the *obj with the value of the struct Node data (template pointer type). I tried head->(*data) , head->data, *head.data, etc, but none of them works.

template struct Node \{ T *data; Node *next; template class Linkedlist\{ private: Node *first; public: Linkedlist (); ninkedlist ( ); bool Insert ( T* obj)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
