D
Daniel
Environment is vs2010sp1 on Windows 7.
Consider the following:
template <typename C>
class A
{
public:
class B;
A()
{
}
A(const A& a)
{
}
void f()
{
std::cout << "Hello world" << std::endl;
}
};
template <typename C>
class A<C>::B : public A<C>
{
public:
B()
{
}
B(size_t n)
{
}
};
If I write
A<char> a(A<char>::B());
a.f();
compilation fails with "error C2228: left of '.f' must have class/struct/union"
But if I change that to
A<char> a(A<char>::B(10));
a.f();
compilation succeeds and the program runs.
Hmmm ... am I doing something wrong?
Thanks,
Daniel
Consider the following:
template <typename C>
class A
{
public:
class B;
A()
{
}
A(const A& a)
{
}
void f()
{
std::cout << "Hello world" << std::endl;
}
};
template <typename C>
class A<C>::B : public A<C>
{
public:
B()
{
}
B(size_t n)
{
}
};
If I write
A<char> a(A<char>::B());
a.f();
compilation fails with "error C2228: left of '.f' must have class/struct/union"
But if I change that to
A<char> a(A<char>::B(10));
a.f();
compilation succeeds and the program runs.
Hmmm ... am I doing something wrong?
Thanks,
Daniel