Original Post
In my array class ( a generic type using templates btw ) I specify a constructor that takes a 32-bit integer variable to be the number of cells in the array. However in my constructor I want to determine whether or not the requested cell value exceeds 65,535 if it does, dont create the array. Heres the constructor Obviously by stating return in the constructor I'm not achieving anything (dont really know if I should actually do that either but, meh!). At first I thought saying delete this; would be the answer but no, it doesn't work. How can I avoid my array class creating the array if the number of cells is greater than I ever want it to be? - Adam
// Constructor
CArray( int iSize )
{
// Check for valid size limit
if( iSize > 65535 )
{
// Write Error Message, eventually
return;
}
else
{
m_pArray = new DType[ iSize ]; // Create the Array
m_iSize = iSize; // Set Array Size
}
return;
}