Hi,
Recently,I have faced two distinctions between "Thinking In C++" from =20
Bruce Eckel and DEV-C++.
He says when you declare a class in side another class (making nested =20
classes), it does not
mean that the inner class is a friend for the outer one at all and you =20
must do like the
following code to make the inner class, friend for the outer one:
class outer
{
public:
class inner; // An incomplete definition.
friend inner; // Making the inner class,friend. ("friend class inner" i=
s =20
illegal).
class inner
{
// class body....
};
};
But DEV-C++ 5 does not let you do so and instead if you define a class =20
inside of the other
one, the inner class will automatically become friend for the outer class=
. =20
And a more strange
stuff: When you use DEV-C++ 4, the compiler obeys the Bruce Eckel's manne=
r =20
to handle this
situation. So what is happening....????
And one furture contrast:
Bruce Eckel says that static const data members use internal linkage (lin=
k =20
ordinary consts)
and this lets you define them inside the header file of you class. But =20
static data members
must be defined just one time so they should be defined in the =20
implementation file of the
class. But DEV-C++ does not allow you to define static const data members=
=20
inside header
files.
Now I want to know the reason of these two differences. What is the rule =
=20
of ISO C++?
Thanks,
--=20
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
|