Can call static method with null reference
Jonathan M Davis
jmdavisProg at gmx.com
Sun Jun 23 03:58:49 PDT 2013
On Sunday, June 23, 2013 12:48:15 monarch_dodra wrote:
> C++ doesn't allow it. I don't know about the rest.
Yes it does. I just tested it. This code compiles and runs just fine
#include <iostream>
using namespace std;
class C
{
public:
static void foo()
{
cout << "I'm static!" << endl;
}
};
int main()
{
C c;
c.foo();
return 0;
}
And just like D, C++ won't allow you to overload on static (also just tested),
so D's behavior in this regard appears to be identical to C++.
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list