using namespace std;
The template & lt; The class T>
Class A;
template
Class B;
template
The template & lt; The class T>
Class A
{
Public:
A (int A) : (A) x
{
}
Friend class B
Private:
int x;
};
template
Class B
{
Public:
B (int) B: y (B)
{
}
Friend void print1 (A & lt; T> & A1, B
{
Cout & lt;
Private:
int y;
};
In the template class A friends add A metaclass B, A friend function is added in the B print1, but not in print1 access A private variable, it can be fully proved that friends do not have sex?
CodePudding user response:
Learn best friend without first template for example,This can be fully proved that friends do not have sex?
If taken literally, the sufficient condition of the so-called cannot just one example can prove,
And friends don't have passed this don't need to prove, it is a mandatory standard regulation, is no proof,
You can say, this example illustrates a friend would not be delivered?
I can only say that this is not a good example,