On Tue, 5 Sep 2017 11:08 pm, Stefan Ram wrote: > Steve D'Aprano <steve+pyt...@pearwood.info> writes: >>[quote] >>The mistake they make is in the definition of >>Figure 7: (Java) Defining a Dog pointer >>Dog d; >>itself. When you write that definition, you are defining a pointer to a Dog >>object, not a Dog object itself. >>[end quote] >>Here Scott mixes up what the compiler does (creates a pointer to a Dog object, >>and what the programmer's Java code does (creates a Dog). > > I have not the whole context in mind, and so I might get > something wrong here, but if > > Dog d; > > is supposed to be interpreted as Java, then it neither > creates a pointer to a Dog object nor it creates a Dog. > > Instead, it declares an unitialized variable d.
Thank you Stefan, your correction is noted. I'm not a Java expert like Scott, and I failed to notice the distinction between: Dog d; and Dog d = new Dog(); so I failed to realise that of course d has no value at all in Scott's example. -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list