I have a function in header file Class2.hpp of the form:
class Class2{
void Test::func(std:: string & text, Class1::enum_var var1, unsigned var2, unsigned &var3);};
I have Class1 of the form:
class Class1{
public:
/// Different literal types
enum enum_var {
enum_var1, enum_var2, enum_var3
}; };
I have defined the above function in Class2.cpp as
void Test::func(std:: string & text, Class1::enum_var var1, unsigned var2, unsigned &var3){
cout<<"inside the function";
}
Now I am calling the above function as:
Class2 clsObj;
std::string text="abc";
int var3=0;
clsObj.func( text, Class1::enum_var1, 0, &var3);
However, when I am running the program its giving me the following errors:
error: no matching function for call to ‘Class2::func(std::string*, Class1::enum_var1, int, int*)’
note: candidate is:
void Class2::func(std::string&, Type::ID, unsigned int, unsigned int&)
note: no known conversion for argument 4 from ‘unsigned int*’ to ‘unsigned int&’
I am not getting how to get rid of the error..can someone be kind enough to help PLEASE.
Also, I want the changes in var3 to be reflected back...therefore apart from returning or passing by reference I have no choice..and when I pass var3 by reference its giving me errors.