So, I'm getting back in the swing of coding things after a few jumps and starts, and have been following along on an OCW course on C++. The current problem I am working on has you develop two classes - a Point and a PointArray - in the same header/cpp file. However, in my PointArray header I get the message"Point is not a type name" from Visual Studio. The two class definitions are
1 2 3 4 5 6 7 8 9 10 11 12 13 14
class Point
{
private:
int x;
int y;
public:
Point(int nx = 0, int ny = 0){ x = nx; y = ny; };
int getX() const{ return x; }
int getY() const{ return y; }
void setX(constint newX){ x = newX; }
void setY(constint newY){ y = newY; }
};
and
1 2 3 4 5 6 7
class PointArray
{
private:
Point *parray; //"Point is not a type name
int length;
};
I thought it was probably just me being silly, and after tinkering with it for half an hour, decided to try just dropping the answer that the course has online into my program. However, It gives me the same issue. Any help would be greatly appreciated.
Sorry, I got busy with work last night and couldn't come back on.
Both of these class declarations are in the same header file. Poor practice, I'm sure, but i was just following along with the course guideline.
std::vector is a c++11 thing, yes? The course I am following along with is c++ 03 based, so I haven't used any c++ 11-isms, even when they would be more efficient/elegant.