hi,
I have a class class A and it has void mymethod(pay m) and i am in class B I want to pass m parameter to the mymethod in the class A. The pay is a struct declared class B.so when i try to pass the m parameter to the mymethod. it says no matching function for call to A::mymethod(m). any idea? do not worry about the pay struct it is defined in class B. mymethod is public. and in different .cc file and declared in .h file.
That's quite difficult to understand. Can you try to explain the problem again please. Posting your actual classes, pay struct and functions might help.
struct someS
{
int age;
char name[32];
}; //this is my struct
//and this is my method signature. the method is in a different mClass.cc
void mClass::myMethod(someS s)
// in my main.cc and im passing it like this
someS t;
mClass m;
m.myMethod(t);
//here it says no matching function call to mClass::myMethod(Somes&);
//candidates are mClass::myMethod(Somes*);
// i tried with pointer and reference still did not work out. any idea?
struct someS
{
int age;
char name[32];
};
struct mClass
{
void myMethod(someS s);
};
void mClass::myMethod(someS s)
{
// do something with s here
}
int main ()
{
someS t;
mClass m;
m.myMethod(t);
return 0;
}
Chances are you have not made something important visible to the piece of program that needs it.
Remember, outside of the current .cc file, the compiler knows absolutely nothing. That's what prototypes and the like are all about, and the word "dependencies".