>How to write a constructor function to initialize the list to an empty list (array).
Code:
Constructor :: Constructor ( int n )
{
// Don't forget to check for errors
array = new char[n];
size = n;
}
>how to make it return true if the list is full
Make a helper function that specifically checks if the array is full and returns true if it is:
Code:
bool Constructor :: isFull()
{
size_t len;
if ( ( len = strlen ( array ) ) == size )
return true;
cout<<"Total space: "<< size <<"\n"
<<"Available space: "<< size - len <<"\n";
return false;
}
And lastly, be sure to free the allocated space with your destructor.
-Prelude