Possible Duplicate:
C++ method only visible when object cast to base class?!
I've the follow code:
class String {
char* _Text;
public:
String( const char* s ) {
int iLen = strlen(s);
_Text = new char [iLen+1];
strcpy( _Text, s );
}
};
template<typename T>
class Vector {
public:
int Add( T* pItem ) { return 0; }
int Add( const T* pItem ) { return 0; }
int Add( T& pItem ) { return 0; }
};
class StrVector : public Vector<String> {
public:
int Add( char* pItem ) { return 0; }
int Add( const char* pItem ) { return 0; }
};
void main()
{
String s;
StrVector v;
v.Add( s ); <-------------
}
The line v.Add( s );
should call Vector::Add(T& pItem)
, right?