digitalmars.D.bugs - Documentation bug
- Tim Keating (11/11) Dec 05 2006 The example given describing how to intialize a delegate type (found on
- Chris Nicholson-Sauls (5/21) Dec 06 2006 So far as I can recall we've never been able to declare-instantiate in t...
The example given describing how to intialize a delegate type (found on
http://www.digitalmars.com/d/type.html) will cause your executable to throw an
access violation if you cut and paste it without modification.
The problem is this line:
OB o;
I suspect (not being very familiar with the history of the language) that in
the precambrian era, perhaps it was legal to declare an instance of a class
this way (& get default construction), but that seems not to be the case
anymore. The line really needs to be:
OB o = new OB();
Tim Keating
Dec 05 2006
Tim Keating wrote:
The example given describing how to intialize a delegate type (found on
http://www.digitalmars.com/d/type.html) will cause your executable to throw an
access violation if you cut and paste it without modification.
The problem is this line:
OB o;
I suspect (not being very familiar with the history of the language) that in
the precambrian era, perhaps it was legal to declare an instance of a class
this way (& get default construction), but that seems not to be the case
anymore. The line really needs to be:
OB o = new OB();
Tim Keating
So far as I can recall we've never been able to declare-instantiate in this
way, so its
probably just a case of good old fashioned left-out-details in a sample
snippet. But
still, good catch -- I can imagine people trying to copy&paste it and getting
frustrated.
-- Chris Nicholson-Sauls
Dec 06 2006








Chris Nicholson-Sauls <ibisbasenji gmail.com>