August 11th, 1999, 12:51 AM
Suppose if I have 2 classes, called class A and class B and is used as follows:
#include "A.h"
#include "B.h"
void main()
{
A objectA;
B objectB;
}
Now class B need to access a variable/function of class A at run time. Simply declare "A objectA;" in class B won't work because a new objectA is created. I want class B refer to the objectA created in main function.
Is there a solution to this? I am new to OOP and hope you can help. Thanks.
#include "A.h"
#include "B.h"
void main()
{
A objectA;
B objectB;
}
Now class B need to access a variable/function of class A at run time. Simply declare "A objectA;" in class B won't work because a new objectA is created. I want class B refer to the objectA created in main function.
Is there a solution to this? I am new to OOP and hope you can help. Thanks.