I've been working with a lot of C and Java lately so I'm a bit confused coming back to C++ on why this is not allowed.
incomplete type is not allowed
#pragma once
class Expression
{
private:
Expression power; // <--- incomplete type is not allowed
};
I believe the answer here is to change the line Expression power
to Expression *power
but I don't understand why that is. I can declare objects like vector<int> var
without having to make them a pointer, but the second I have an object of the same type as the file it's being declared in, I need one? I've looked around but cannot find any tutorials/videos on a class making an object of itself.