[comp.lang.c++] initializing nested classes

richard@ben.Jpl.Nasa.Gov (Conan the Barbarian) (03/10/90)

Is there a way to initialize a nested class using a value (variable)
in the constructor for the nesting class?

For example I have a class which creates a window, the window contains
a panel and several buttons. The window constructor creates a window
which is used to create a panel which is then used in the calls to 
create the buttons. However, if I create the buttons as classes 
which are members of the window class, the
constructor for the buttons is called before the constructor for the
window is entered. Bass-ackwards so to speak. I get an error message 
indicating the panel variable is not defined in the button initializer
reference. 

base_frame::base_frame(char *stuff):button(panel,more_stuff)
{
	Panel panel;
	.
	.
	.
}

This may be a question of improper construction of the classes. Or there
may be a way of delaying the member construction (sounds unlikely to me).

Any suggestions would be appreciated. The example does not seem like 
a radical approach for an "object oriented" language. I have rtfm'd
with no luck. The references (Stroustrup, AT&T, Sun) don't seem to talk
about non-trivial constructors for nested classes. Possibly the
answer is trivial but I just don't see it.