|
-
September 20th, 2010, 04:43 AM
#1
accessing variable of a class without instantiating or using static keyword
I have a public/private variable (var) in class X, which I need to access from class Y.
The constraints are that class X is instantiated only once from the application. It cannot be instantiated in class Y again.
and
the variable (var) cannot be made static, as 2 different applications instantiating this class X should see the variable differently.
and cannot make the class Y nested in class X, also in class Y the func() arguments cannot be added, because this function is being called from somewhere in the state machine which passes on only 2 arguments.
class X
{
public:
int a;
};
class Y
{
static func(int aa, int bb)
{
a = 1; //want to perform the set/get operations from this class for 'a'...
}
};
require experts help in solving this,
thanks in advance.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|