This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
int main();
struct A
{
virtual ~A() {}
};
struct B
{
virtual ~B() {}
};
struct O : A, private B
{
friend int main();
virtual ~O() {}
};
int main()
{
using namespace std;
A * p = new O;
cout << "A * = " << dynamic_cast<A *>(p) <<
endl;
cout << "B * = " << dynamic_cast<B *>(p)
<< endl;
cout << "O * = " << dynamic_cast<O *>(p)
<< endl;
}
Outputs:
A * = 0x8049fd0
B * = (nil)
O * = 0x8049fd0
Notice:
If I the inheritance of B into O becomes public, the address of B *
becomes 0x8049df4.
Question:
I was wondering why friendship is not affecting dynamic casting scope.
Thank you.
begin:vcard n:Bouchard;Philippe x-mozilla-html:FALSE org:Corel Linux adr:;;;;;; version:2.1 email;internet:philippeb@corel.com title:Software Engineer x-mozilla-cpt:;0 fn:Philippe Bouchard end:vcard
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |