Static function conflicts with Non-Static?!

H. S. Teoh hsteoh at quickfur.ath.cx
Sat Jun 2 08:41:17 PDT 2012


On Sat, Jun 02, 2012 at 01:23:50AM -0700, Jonathan M Davis wrote:
[...]
> Personally, I wish that it weren't legal to call a static function
> with an object and that you had to explicitly use the class, but
> that's not the way that it is in D, C++, and Java (and probably the
> same for C#, though I'm not sure).
[...]

I've always been of the opinion that static methods should _only_ be
callable via the class name. If an instance is not needed, then it
shouldn't be used in the first place. Allowing the use of a class
instance where it's not needed is needlessly confusing and prevents
legal overloading of static methods vs. non-static methods.


T

-- 
If Java had true garbage collection, most programs would delete themselves upon execution. -- Robert Sewell


More information about the Digitalmars-d-learn mailing list