I am in my classA.cpp
In class A there is a method:
doSomething ()
Ok, now, I'm in my main.cpp and I'm creating an object from class A and i can use the method of this class and it works.
A a1;
a1.doSomething ()
Now I am in my ClassB.cpp And here I wish I could create a method like this:
orderA ()
{
a1.doSomething ()
}
But of course, I can not do it because ClassB does not know the objects. I told myself that when creating ClassB I could pass it the reference of the object (a1). But I do not know how. I can not understand how to define the type of the object(a1) in classB.h etc... I am a beginner as you can see. Can someone explain to me?
Finally, in my main.cpp I wish I could create a ClassB object and do:
B b1;
b1.orderA;
Thanks for your help :)