Error function may not be redeclared outsied of its class


Possessions.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
class Possessions
{
    private:
        Item    *m_pRoot;

    public:
        Possessions();                       // Class constructor
        ~Possessions();                      // Class destructor
        bool addItem(Item *newItem);         // Add an item to this list
        Item *dropItem(char *itemName);      // Delete an item from this list
        Item *getItem(char *itemName);       // Return a pointer to an item
        void printTree();                    // Print list of all items in tree

    private:
        void printOne(Item *item);           // Print a single item.
        void destroyTree(Item *rt);          // Recursively destroy the tree
        void printAll(Item *rt);             // Recursively print all items in tree
};


Posessions.cpp
1
2
3
4
void Possessions::destroyTree(Item *rt);
{

}


error "Possessions::destroyTree" function may not be declared outside of its class
any help?
Last edited on
lol had a ;... fixed it now
I have made this mistake many times. It happens easily when copying the function declaration from the class definition.
Last edited on
Registered users can post here. Sign in or register to post.