Am Sun, 12 Aug 2012 00:23:10 +0200
schrieb "Namespace" <rswhi...@googlemail.com>:

> This code works fine but it shouldn't, or?
> 
> http://dpaste.dzfl.pl/b9027fff

That's fine. There is no check for null at every possible occasion, like I 
think in Java. The operating system will catch any actual null dereference 
though, by notifying you of an invalid memory access.
So in other words, D uses the fast approach.

Cases where your print will not work is, when print() is a virtual method of 
that class (one that can be overridden). That would need to actually 
dereference the object to take a look into the virtual method table.
'private' and 'final' methods (or methods of a 'final class') are not virtual.

-- 
Marco

Reply via email to