Can call static method with null reference

Jacob Carlborg doob at me.com
Thu Jun 20 12:29:30 PDT 2013


On 2013-06-20 21:17, w0rp wrote:
> You are invoking a function effectively stored statically in a class
> namespace. So you never actually dereference the null reference. You're
> just calling a function that doesn't really have anything to do with the
> reference. I prefer to tell it like it is and call the static method
> with the class name, so in this case that would be Foo.test1.

Yeah. It's possible to call any non-virtual method without dereferencing 
a null reference.

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list