Hello Friends I'm facing a problem and I can't figure out what is the wrong ( it is a Run~Time~Error)
I have these two classes
// singly-linked list class to store integers
#ifndef INT_LINKED_LIST
#define INT_LINKED_LIST
class IntSLLNode {
public:
int info;
class IntSLLNode *next;
IntSLLNode(int el, IntSLLNode *ptr = 0) {
info = el; next = ptr;
}
};
class IntSLList {
public:
IntSLList() {
head = tail = 0;
}
~IntSLList();
void Attach(IntSLList);
private:
IntSLLNode *head, *tail;
};
#endif
and I have the implementation and the main as the following :
#include <iostream>
#include "Header.h"
using namespace std;
//I have the constructors and the other function written correctly //here
void IntSLList::Attach(IntSLList list)
{
cout<<"------"<<endl;
}
void main()
{
IntSLList lst;
IntSLList xst;
lst.Attach(xst);
}
the problem is in the Attach method when I send the (xst) list and it is a run time error .. The Erros is [ block type is valid(phead->nblockuse ]