>
T* temp = new T;
http://www.cplusplus.com/forum/general/138037/
> I am getting a lot of errors
I'm not going to bother my mind-reading cat.
¿compile errors? Your snip is too small and references things that we don't know about (an AVLNode class, by instance), so you must post the compiler messages.
¿runtime error? (crash) again, we cannot compile that snip, much less run it. Get a debugger and identify the line where is crashing. You may also use tools like valgrind to discover invalid memory access.
¿wrong output? show expected and erroneous output, and also and example input.
Provide a testcase
http://www.eelis.net/iso-c++/testcase.xhtml
Looking at your code, if the node is invalid you return -1.
If not, you set a `depth' variable to 0 and then increment it once (any path will do that) and return it. So you're simply returning 1.
Every you call the `getDepth()' function another `depth' variable is created, so it doesn't matter what you do to one of them, the others are not affected. Yes, they have the same name but they are not the same variable.