Héritage et Spécialisation Template
Bonjour a tous j'ai (encore) une question:
J'ai une classe ClovisVariable et plusieurs autre classe qui héritent de celle-ci : CString CFloat CInteger ...
J'ai crée une Class Node dont j'ai spécialisé une fonction. voici un bref résumé.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
template <class T>
Class Node{
public:
Node();
void getPath();
}
template <class T>
T * Node<T>::getPath(){
std::cout << "Type Inconnu" << std::endl;
return NULL;
}
Node<ClovisVariable> * Node<ClovisVariable>::getPath(CString name){
std::cout << "clovis variable" << std::endl;
return NULL;
} |
Donc quand je fais ceci:
Code:
1 2 3
|
Node<CString> * j = new Node<CString>();
j->getPath(); |
Il m'affiche type inconnu alors que j'aimerai qu'il m'affiche Clovis Variable
Je ne sais pas quoi faire pour que quand je mets
Code:
1 2 3 4
|
Node<CString> * j = new Node<CString>();
Node<CInteger> * i = new Node<CInteger>();
Node<CFloat> * k = new Node<CFLoat>(); |
a chaque fois que je fais appel à la fonction getPath() il m'affiche Clovis Variable.
Quelqu'un peut il m'eclairer de ses lumières?