|
Archives
D Programming
DD.gnu digitalmars.D digitalmars.D.bugs digitalmars.D.dtl digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript |
c++ - question about accessing static member
Could someone help with the following question:
If the following example compiles without errors, why doesn't it work when I
make the member B::a static? (It works with Borland C++)
This one compiles without error:
template<class T> struct A { T t; };
class B {
private:
struct C { int i; };
A<C> a;
public:
B() { a.t.i = 0; }
}
Error: member 'B::C' of class 'B' is not accessible
template<class T> struct A { T t; };
class B {
private:
struct C { int i; };
static A<C> a; // member a made static
public:
B() { a.t.i = 0; }
}
A<B::C> B::a;
Sorry for my poor English.
Sep 09 2004
Szabolcs Horvát wrote: Sep 09 2004
|