On 13/3/06 22:43, in article
,
"Kaba" <> wrote:
> Why doesn't the following work?
>
> template <typename Type>
> class A
> {
> public:
> Type data_;
> };
>
> template <typename Type>
> class B: public A<Type>
> {
> public:
> void set()
> {
> data_ = 4;
> }
> };
>
> int main()
> {
> B<int> b;
> b.set();
> return 0;
> }
>
> If you declare "using A<Type>::data_;" then it works.
But do you understand why that works?
> If you use normal
> classes, this works without "using". I don't get it. Tested with
> msvc2005 and comeau. Words from the standard?
At the risk of doing your homework for you, have a read of
<http://www.parashift.com/c++-faq-lite/templates.html#faq-35.18>
Apart from your example using a member variable and the example in the FAQ
using a member function, they're both remarkably similar!
--
Regards,
Steve
"...which means he created the heaven and the earth... in the DARK! How good
is that?"