Re: Constructor Behavior
On Sep 12, 4:34 am, "Victor Bazarov" <v.Abaza...@comAcast.net> wrote:
Randy wrote:
That was exactly my confusion. As I am new, I just assume that I am
missing a finer point.
The finer point here *may* be that "everything should be initialised
or something bad's gonna happen" rule is a good rule to live by. But
of course the author would know better, and if they didn't explain
(there or elsewhere in the book), you and I are left to guess...
Let's not forget that the author is providing this code as an
example. In practice, the base class might not have a default
constructor (or the default constructor might not be the one we
want), so his example includes a call to the base class
constructor. (But I'm not too sure about this. In the
decorator pattern, the base class will almost surely be an
interface, whose only constructors are the compiler generated
default and copy constructors.)
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34