[Issue 830] Access to static member variable causes Access Violation
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Jan 11 05:47:51 PST 2007
http://d.puremagic.com/issues/show_bug.cgi?id=830
------- Comment #2 from ralfs72 at gmx.net 2007-01-11 07:47 -------
(In reply to comment #1)
> this ain't a bug. coz getv ain't static
>
And? What's the problem with it? Is it not possible to access static vars in a
member function?
Of course the opposite way can not work: Access non static member vars from a
static member function.
Well the equivalent C++ programm works:
class A
{
public:
static int v;
int getv()
{
return v;
}
};
int A::v = 1;
int _tmain(int argc, _TCHAR* argv[])
{
A a;
printf("%d\n", a.getv());
}
--
More information about the Digitalmars-d-bugs
mailing list