G
Guest
Hello,
I have a class X with a member function setConfigValues(). I want to
access this member function in another class Y. Y is not inherited from
X. A member function of class X called run() this instanciates the
class Y.
Class X
{
run();
setConfigValues();
}
X::run()
{
Y y();
y.start();
}
Y::start()
{
X::setConfigValues();
}
I can't make setConfigValues() a static function because it accesses
member functions and variables that are not static.
What is the best way of accessing setConfigValues() from other classes.
There are other objects instanciated in class X that setConfigValues()
uses so don't think I can use friend functions. I need to access
setConfigValues() as it is in memory in class X.
Hopes this makes sence and wonder what is the best way of doing it.
If the best way is by passing a reference or pointer how do I do this.
Thanks,
Enda
I have a class X with a member function setConfigValues(). I want to
access this member function in another class Y. Y is not inherited from
X. A member function of class X called run() this instanciates the
class Y.
Class X
{
run();
setConfigValues();
}
X::run()
{
Y y();
y.start();
}
Y::start()
{
X::setConfigValues();
}
I can't make setConfigValues() a static function because it accesses
member functions and variables that are not static.
What is the best way of accessing setConfigValues() from other classes.
There are other objects instanciated in class X that setConfigValues()
uses so don't think I can use friend functions. I need to access
setConfigValues() as it is in memory in class X.
Hopes this makes sence and wonder what is the best way of doing it.
If the best way is by passing a reference or pointer how do I do this.
Thanks,
Enda