Static function conflicts with Non-Static?!
Regan Heath
regan at netmail.co.nz
Wed Jun 6 02:15:07 PDT 2012
On Sat, 02 Jun 2012 09:23:50 +0100, Jonathan M Davis <jmdavisProg at gmx.com>
wrote:
> ...and probably the same for C#, though I'm not sure
No, in C# you cannot call a static member function with a class instance,
see "Static Members":
"A static method, field, property, or event is callable on a class even
when no instance of the class has been created. If any instances of the
class are created, they cannot be used to access the static member."
http://msdn.microsoft.com/en-us/library/79b3xss3(v=vs.80).aspx
It does cause some people some consternation. Some more background:
http://underground.infovark.com/2008/03/28/calling-a-static-method-from-an-object-instance-in-c/
IMO it's a good decision not to allow it.
R
--
Using Opera's revolutionary email client: http://www.opera.com/mail/
More information about the Digitalmars-d-learn
mailing list