Topic: A nested class derived from the class in which it is nested
Author: tug@cix.compulink.co.uk ("John Wilson")
Date: Thu, 3 Mar 1994 18:23:45 GMT Raw View
I wish to declare a nested class which used the class in which it is
nested as a base class. I obviously can't write:
class fred {
class jim : public fred {};
};
as fred is not defined until immediatly before the final semicolon.
ARM section 9.3 (p.174) says "Members may be defined (secition 3.1)
outside their class declaration if they have already been declared but
not defined in the class declaration;....."
So I wrote:
class fred {
class jim;
};
class fred::jim : public fred {};
My compiler (Microsoft VC++ 1.5) doesn't like it. Microsoft say section
9.3 only applies to functions. I say the section says members when it
means members and member functions when it means member functions.
What do you say?
If I'm wrong (which is usually the case) is it possible to do what I want
to do and if so how?