M
mailforpr
Here's an examble:
template<class C> struct S
{
C c;
};
template<class C> struct D
ublic S<C>
{
void f(C temp)
{
c=temp;
}
};
int main()
{
D<int> i;
i.f(2);
return 0;
}
Error message (compiled with g++ 3.4):
In member function `void D<C>::f(C)':
error: `c' undeclared (first use this function)
D is a S, so D should have public access to c. But it hasn't. Does
someone know why that is so?
template<class C> struct S
{
C c;
};
template<class C> struct D
{
void f(C temp)
{
c=temp;
}
};
int main()
{
D<int> i;
i.f(2);
return 0;
}
Error message (compiled with g++ 3.4):
In member function `void D<C>::f(C)':
error: `c' undeclared (first use this function)
D is a S, so D should have public access to c. But it hasn't. Does
someone know why that is so?