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é.
Donc quand je fais ceci:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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; }
Il m'affiche type inconnu alors que j'aimerai qu'il m'affiche Clovis Variable
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3 Node<CString> * j = new Node<CString>(); j->getPath();
Je ne sais pas quoi faire pour que quand je mets
a chaque fois que je fais appel à la fonction getPath() il m'affiche Clovis Variable.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4 Node<CString> * j = new Node<CString>(); Node<CInteger> * i = new Node<CInteger>(); Node<CFloat> * k = new Node<CFLoat>();
Quelqu'un peut il m'eclairer de ses lumières?
Partager