Question
Im making a generic linked list. I cant figure out how to make an object of my class from main. My 3 files are main.cpp
Im making a generic linked list.
I cant figure out how to make an object of my class from main.
My 3 files are main.cpp dan.h dan.cpp
The error is: 15 6 [Error] prototype for 'void ll
#include
#include
#include "dan.h"
using namespace std;
int main()
{
ll
work.insert(55);//THIS IS THE LINE THATS GIVING ME THE ERROR, Without this line it compiles and //runs.
}
#ifndef DAN_H
#define DAN_H
#include
#include
using namespace std;
template
struct node
{
T data;
node *next;
};
template
class ll
{
public:
ll();
void insert(T item);
void print();
private:
node
int len;
node
};
#endif
#include
#include
#include "dan.h"
using namespace std;
template
ll
{
head=NULL;
cur=NULL;
len=0;
}
template
void ll
{
node
temp->data=item;
if(head==NULL)
{
head=temp;
head->next=NULL;
}
else
{
temp->next=head;
head=temp;
}
}
template
void ll
{
node
while(temp!=NULL)
{
cout< temp=temp->next; } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started