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
class IntSLLNode {
    int info;
    class IntSLLNode *next;
    IntSLLNode(int el, IntSLLNode *ptr = 0) {
        info = el; next = ptr;
class IntSLList {
    IntSLList() {
        head = tail = 0;

    	void Attach(IntSLList); 
    IntSLLNode *head, *tail;

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) 

void main()

IntSLList lst;
IntSLList 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 ]

The code seems to work fine, except for the part where the list destructor is missing its implementation.

I included this destructor in my code but the problem still there

IntSLList::~IntSLList() {
    for (IntSLLNode *p; !isEmpty(); ) {
        p = head->next;
        delete head;
        head = p;

Ok well, I copied/pasted the code into visual studio and added an empty destructor function, and the code runs without error. I see that in your destructor there is also another function isEmpty() which has not been declared within the code you provided. My best guess is that the problem is not the code that you posted but elsewhere.

my friend SUMY actually I have do the isempty function written as the following

int isEmpty() {
        return head == 0;

but I didnt write it here just not to make the code so long
but you know what .... my code just worked ...
soon I will get a heart attack because of C++
thank you for your help .
and actually this is solved but I dunno how .