Topic: friend declarations and private inheritance
Author: John Aldridge <jpsa@jjdash.demon.co.uk>
Date: 1998/05/30 Raw View
Is the following example supposed to compile? I hadn't expected it to,
but three separate compilers (Borland/MSVC/Digital OpenVMS) seem to
interpret the "friend" declaration within Base as making Derived's
private inheritance of Base behave as if it were public as seen from
class Random. Two others (old versions of gcc and HP's compiler) reject
it.
class Base {
friend class Random;
public:
void beth ();
};
class Derived: private Base {
};
class Random {
public:
void ruth (Derived &d);
};
void Random::ruth (Derived &d)
{
d.beth ();
}
--
Cheers,
John
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]