Class method as a friend of a class
Posted: Mon Jul 09, 2007 6:13 am
Hello, as I'm on the run, I have no time to explain much.
I would like a class method (only one) to be able to access private data of another class. However, if I know how to make an entire class the friend of another class, I do not know how to do it for a single method
Ex:
class ABC {
public:
sing() {
say(song)
private:
string song = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
class ABCModify {
bool ChangeSong(string NewSong);
}
I want ABCModify::ChangeSong to be the friend of class ABC
Thanks in advance for any information
I would like a class method (only one) to be able to access private data of another class. However, if I know how to make an entire class the friend of another class, I do not know how to do it for a single method
Ex:
class ABC {
public:
sing() {
say(song)
private:
string song = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
class ABCModify {
bool ChangeSong(string NewSong);
}
I want ABCModify::ChangeSong to be the friend of class ABC
Thanks in advance for any information