K
Kasper Middelboe Petersen
Hi,
I have:
class Process {
virtual void run();
...
};
class Processes : public Process {
...
private:
std::list<Process*> plist;
};
// helper function
void Run(Processes& p) {
p.run();
}
Now my wish is to only allow the member function run() to be invoked
from the helper function and nowhere else. This should be doable by
adding "friend void Run(Processes& p);" to the Processes class. The
run function in Processes basically is to go trough its plist running
the run function on each Process.
How do I make this possible without having run in Process declared as
public?
Thanks,
Kasper
I have:
class Process {
virtual void run();
...
};
class Processes : public Process {
...
private:
std::list<Process*> plist;
};
// helper function
void Run(Processes& p) {
p.run();
}
Now my wish is to only allow the member function run() to be invoked
from the helper function and nowhere else. This should be doable by
adding "friend void Run(Processes& p);" to the Processes class. The
run function in Processes basically is to go trough its plist running
the run function on each Process.
How do I make this possible without having run in Process declared as
public?
Thanks,
Kasper