Pegun
Golden Member
Has anyone ever heard of or used the return type Error_code in c++ .net version? I'm trying to write a function of a class to provide an error code if the stack is full using the following code:
Error_code Extended_stack:😛ush(Stack_entry item)
/*Pre: None
Post: If the stack is not full, item is added to the top of the stack.
If the stack is full, and error_code of underflow is returned and the
stack is left unchanged*/
{
Error_code outcome = success;
if(count >= maxstack)
outcome = overflow;
else
entry[count++] = item;
return outcome;
}
The compiler wont let me use Error_code even when i define it in my public functions.
Error_code Extended_stack:😛ush(Stack_entry item)
/*Pre: None
Post: If the stack is not full, item is added to the top of the stack.
If the stack is full, and error_code of underflow is returned and the
stack is left unchanged*/
{
Error_code outcome = success;
if(count >= maxstack)
outcome = overflow;
else
entry[count++] = item;
return outcome;
}
The compiler wont let me use Error_code even when i define it in my public functions.