class A {
public:
function1();
function2();
//----------------------
int main() {
A aObject;
aObject.function();
}
int test() {
aObject.function2();
}
How do I use the same object from the main in the test function? I know I can do it in 2 way: make the object universal which is a bad idea, or pass it by reference. I'm not sure how to do that tho. Thanks!
class A
{
public:
function1();
function2();
};
int test (A & aobj); // Function prototype required
int main()
{ A aObject;
aObject.function(); // There is no "function" in aObject.
test (aObject);
}
int test (A & aobj) // pass by reference
{ aobj.function2();
}