- #1
shwanky
- 43
- 0
So I have this Class Random that needs to have a friend function sort which needs to exist in two namespaces.
Class Random
{
... Some stuff
friend void sort(Random &x);
}
namespace ascending
{
void sord(Random &x)
{
... Some Stuff
}
}
namespace descending
{
void sort(Random &x)
{
... Some Stuff
}
}
The problem is I need sort to be able to access the private members of the Random class but to define sort I need to have the namespaces ascending and descending already declared... Its a weird circular argument that can't work. My question is, how can I define the Class Random with so that it can have a friend function sort that resides in two namespaces?
Class Random
{
... Some stuff
friend void sort(Random &x);
}
namespace ascending
{
void sord(Random &x)
{
... Some Stuff
}
}
namespace descending
{
void sort(Random &x)
{
... Some Stuff
}
}
The problem is I need sort to be able to access the private members of the Random class but to define sort I need to have the namespaces ascending and descending already declared... Its a weird circular argument that can't work. My question is, how can I define the Class Random with so that it can have a friend function sort that resides in two namespaces?