Passing enum value thru a function call using C++

Write here if you have problems with your C++ source code

Moderator: Board moderators

Post Reply
nano72
New poster
Posts: 10
Joined: Tue Sep 05, 2006 5:25 pm

Passing enum value thru a function call using C++

Post 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
???
mf
Guru
Posts: 1244
Joined: Mon Feb 28, 2005 4:51 am
Location: Zürich, Switzerland
Contact:

Post by mf »

not is a keyword in C++. Your program shouldn't have any identifiers with such name.
nano72
New poster
Posts: 10
Joined: Tue Sep 05, 2006 5:25 pm

Post 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
};
Post Reply

Return to “C++”