소스는 인포북에 있는 것이고요. 그런데, 컴파일러는 에러메세지를 냅니다.
소스는 다음과 같습니다.
#include <iostream.h>
typedef unsigned short int USHORT;
class Rectangle
{
public:
Rectangle(USHORT width , USHORT height);
~Rectangle(){}
void DrawShape() const;
void DrawShape(USHORT width , USHORT height) const;
private:
USHORT Width;
USHORT Height;
};
Rectangle::Rectangle(USHORT width , USHORT height)
{
Width = width;
Height = height;
}
void Rectangle::DrawShape() const
{
DrawShape(Width , Height);
}
void Rectangle::DrawShape(USHORT width , USHORT height) const
{
for(USHORT i=0 ; i<height ; i++)
{
for(USHORT j=0 ; j<width ; j++)
{
cout << "*";
}
cout << "\n";
}
}
void main()
{
Rectangle theRect(30,5);
cout << "DrawShape()\n" << DrawShape() << endl;
cout << "\nDrawShape(40,2)\n" << DrawShape(40,2) << endl;
}
에서 컴파일 에러메세지는
Error : Function "DrawShape" should have a prototype.
이라고 출력됩니다.
어디서 무엇이 문제인지 좀 어렵네요.
|