I have some code like following:
template<class T>
class A
{
public:
A(T& t) : m_b(t){};
void Func()
{
m_b.DoSome();
};
private:
B<tm_b;
};
---------------------------------------
template<class T>
class B
{
public:
void DoSome() {
cout << "type t";
};
private:
T &t;
};
template<>
void B<int>::DoSome( )
{
cout << "type int";
}
---------------------------------------
main()
{
A<inta;
a.Func();
}
the output is "type t" instead of "type int", why?! any help is
appericiated.
template<class T>
class A
{
public:
A(T& t) : m_b(t){};
void Func()
{
m_b.DoSome();
};
private:
B<tm_b;
};
---------------------------------------
template<class T>
class B
{
public:
void DoSome() {
cout << "type t";
};
private:
T &t;
};
template<>
void B<int>::DoSome( )
{
cout << "type int";
}
---------------------------------------
main()
{
A<inta;
a.Func();
}
the output is "type t" instead of "type int", why?! any help is
appericiated.
Comment