C++ Error: "member Engine::x is not a type name" -
i'm bulding standard 4 func calculator, , i'm trying pass 2 numbers off parameters user has entered. within engine.h class have declared
float num1, num2;
and have function
float add(num1, num2);
in these params, num1 , num2 both have error stated in title: "error: member engine::num1 not type name." i'm confused why these bringing errors, isn't how parameters work?
simply declare member function as
float add() const;
as function deal data members num1 , num2 needs no parameters. example defined as
float engine::add() const { return num1 + num2; }
as error forgot write type specifiers of parameters.
instead of
float add(num1, num2);
there shall @ least
float add( float num1, float num2);
Comments
Post a Comment