My question is pretty simple. I'm learning about friend functions, but this does not work for some reason. It only words if i swap the screen class with the Window_Mgr class, and then add a forward declaration of the screen class. Does it not work because screen doesn't know of the existence of "Relocate" at that point in time?
class Window_Mgr;
class screen
{
public:
typedef string::size_type index;
friend Window_Mgr& Window_Mgr::relocate(int, int, screen&);
private:
int width, height;
};
class Window_Mgr
{
public:
Window_Mgr& relocate(int r, int c, screen& s);
private:
};
Window_Mgr& Window_Mgr::relocate(int r, int c, screen& s)
{
s.height=10;
s.width=10;
};
int main(int argc, char* argv[])
{
system("pause");
}