Andrew McDonagh <> writes:
> The reason for initializer lists in C++ is due to c++ refs always
> having to be initialised to refer to some object.
Another reason is that C++ objects may have member variables that
aren't refs, but are objects of a class with no default constructor
(that is to say, no public constructor with no arguments). The
enclosing object's constructor therefore needs some way to provide
argument values for the members' constructors, since the members are
initialized before the main body of the enclosing object's constructor
is entered. As you wrote, Java does not need this, since all member
variables in Java are references initialized to null.
--
,------------------- Markus Bjartveit Krüger ---------------------.
' `
` E-mail:
WWW:
http://www.pvv.org/~markusk/ '
)-------------------------------------------------------------------(