Page 1 of 1

Passing enum value thru a function call using C++

Posted: Thu Sep 14, 2006 7:12 pm
by nano72
Hi ,
I am having some difficult in passing

inthe header file
enum operatorType
{
add,sub,mult,not
};
operatorType p_operatorType;
Class{
}

in the .cc file
calling
fn (A, p_operatorType,B);


have it defined like so

double fn(double A, enum operatorType *op, double B )


Any ideas why the C++ compiler doesn't like enum type
???

Posted: Thu Sep 14, 2006 8:09 pm
by mf
not is a keyword in C++. Your program shouldn't have any identifiers with such name.

Posted: Fri Sep 15, 2006 10:20 am
by nano72
Ooops I meant to put opt infront of the operators ( it was a typo made in giving u the sample code)

should be
enum operatorType
{
opt_add,opt_sub,opt_mult,opt_not
};