c++ - I've been trying to implement and AVL Tree but I keep on getting these 2 errors C2954 and C2955 and don't know how to solve them -
Here is my code. I have a related error message that is next to this line
// AVL tree non-affiliate template & lt; Class Element & gt; Class AVLtree {public: integer height (AVLnode & gt; element & gt; *) CONST; Integer maximum (int, int) const; }; // Work to get maximum template; & Lt; Class Element & gt; Intavetry & lt; Element & gt; :: Maximum (int a, int b) {returns (a and g; b) a: b); } // Error: 'Avltree & lt; Element & gt; :: max ': Unable to resolve function overload // Work to calculate height template & lt; Class element & gt; // Error: Error C2954: Template Definitions nonsheart adventure & lt; Element & gt; :: Balance Factor (AVLnode & gt; Element & gt; * p) {Return (height (p- & gt; left)) - height (P-> right)); First error is that you have declared max < If you are having a const
member function, you are trying to define it as a non- const
member function. In the definition you will need to add const
: template & lt; Class Element & gt; Intavetry & lt; Element & gt; :: Maximum (int a, int b) cost {return std :: max (a, b); }
I can not make much sense of the other error but it may be due to the previous error as it does not use the name declared in the section of the posted square, so it is something different It can also happen.
Comments
Post a Comment