J'utilise une classe abstraite SetOfInt
; d'où hérite une classe de base Btree. La déclaration de la fonction virtuelle find me donne une erreur de compilation et je n'arrive pas à comprendre pourquoi ?
C'est l'erreur exacte :
SetOfInt.h:21 : error : expected unqualified-id before
'virtual'
SetOfInt.h:21 : error : déclarateur abstrait'Node*'
utilisé comme déclaration
SetOfInt.h:21 : error : expected';'
antes de'virtual'
SetOfInt.h:30 : error : expected unqualified-id before'virtual'
SetOfInt.h:30 : error : déclarateur abstrait'Node*'
utilisé comme déclaration
SetOfInt.h:30 : error : expected';'
antes de'virtual'
Toute aide serait très appréciée !
/* 1 */ #include <cstdlib>
/* 2 */ #include <iostream>
/* 3 */
/* 4 */ using namespace std;
/* 5 */
/* 6 */ class Node
/* 7 */ {
/* 8 */ public:
/* 9 */ Node (int x);
/* 10 */ int m_data;
/* 11 */ Node *m_left;
/* 12 */ Node *m_right;
/* 13 */ };
/* 14 */
/* 15 */ class SetOfInt
/* 16 */ {
/* 17 */ public:
/* 18 */ void virtual add(int x)=0;
/* 19 */ bool virtual test(int x)=0;
/* 20 */ bool virtual remove(int x)=0;
/* 21 */ Node* virtual find(int x)=0;
/* 22 */ };
/* 23 */
/* 24 */ class Btree : public SetOfInt
/* 25 */ {
/* 26 */ public:
/* 27 */ void virtual add(int x);
/* 28 */ bool virtual test(int x);
/* 29 */ bool virtual remove(int x);
/* 30 */ Node* virtual find(int x);
/* 31 */ Node *m_root;
/* 32 */ };