On Apr 17, 1:11 am, holmescn <holmesco...@gmail.comwrote:
I want to know who called these functions:
the constructor
the copy constructor
the question from this code:
class A
{
void func();
This member function is private
>
};
class B
{
friend class A:
The above colon is a syntax error
private:
B();
This ctor is declared but not defined anywhere
>
};
void A::func()
{
B();
}
different compiler make different result.
who can explain?
Thx vary much.
Try something that compiles, then ask your question...
#include <iostream>
class A
{
public:
void func();
};
class B
{
friend class A;
private:
B() { std::cout << "B()\n"; }
};
void A::func()
{
B b;
}
int main()
{
A a;
a.func();
}
/*
B()
*/