#include<iostream>
using namespace std;
class node
{
public:
int data;
node *next;
}*head;
class linkedlist
{
private:
node *first;
public:
linkedlist(){first=NULL;}
linkedlist(int A[], int n);
~linkedlist();
};
void linkedlist :: display(){
node *p = first;
while(p!=0){
cout<<p->data<<" ";
p=p->next;
}
}
int main(){
int A[]={2, 3, 4, 5, 6};
linkedlist l(A,5);
l.display();
}
I am getting this error :
C:\Users\DELL\AppData\Local\Temp\ccEQYgIh.o:ll_using_class.cpp:(.text+0x98): undefined reference to linkedlist::linkedlist(int*, int)' C:\Users\DELL\AppData\Local\Temp\ccEQYgIh.o:ll_using_class.cpp:(.text+0xaf): undefined reference to
linkedlist::~linkedlist()'
C:\Users\DELL\AppData\Local\Temp\ccEQYgIh.o:ll_using_class.cpp:(.text+0xc2): undefined reference to `linkedlist::~linkedlist()'
collect2.exe: error: ld returned 1 exit status