Can call static method with null reference

Namespace rswhite4 at googlemail.com
Sun Jun 23 03:02:42 PDT 2013


> I don't see what's so terrible about it

It's bug prone.

class Foo {
public:
	static void test1() { }
	void test2() { }
}

Foo f;
f.test1(); /// Oh nice, that works, f is not null.
f.test2(); /// WTF? f is null?

Also I don't know why I should call static methods from an 
instance. What's the purpose?


More information about the Digitalmars-d-learn mailing list