Here is the problem i am facing, does anyone have solution?
Class A: public class B
{
// I want to pass a reference of B to Function
}
void ClassC::Function(class& B)
{
//do stuff
}
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The way you are declaring the class is wrong:
You simply need to pass the object of type
Ato theFunction. It’ll work.It’s good to declare the parameter as
constif you want to take derived types too.To pass the
thisinstance, you’d simply call: