I am trying to call a constructor from the class RightTriangle, but i get the following error messages:
client.cpp(14) : error C2065: 'RightTriangle' : undeclared identifier
client.cpp(14) : error C2146: syntax error : missing ';' before identifier 'left_nostril'
client.cpp(14) : error C2065: 'left_nostril' : undeclared identifier
I know what the error messages mean. I just understand why i get them. I have triangle.h declared. Here is my client code, triangle.h, and triangle.cpp.
*************client code********************
#include "triangle.h"
enum Direction{NW,NE,SW,SE};
int main()
{
RightTriangle left_nostril(36,7,4,NW); //this is where the 3 errors occur
return 0;
}
***********triangle.h*******************
#include "shape.h"
class RightTriangle : public Shape
{
public:
RightTriangle (int xx,int yy,int ss,int qq);
private:
int x;
int y;
int s;
int q;
};
***********triangle.cpp******************
#include "triangle.h"
enum Direction{NW,NE,SW,SE};
Direction d;
RightTriangle::RightTriangle(int xx,int yy, int ss, int qq)
{
x=xx;
y=yy;
s=ss;
q=qq;
if (q==0)
d=NW;
if (q==1)
d=NE;
if (q==2)
d=SW;
if (q==3)
d=SE;
}
Any help would be appreciated. I can't revise my program anymore until this problem is resolved.