|
바쁘실텐데.^^
이것좀 봐주세요.. 책보구 공부하구 있는데..
클래스쪽에서 뭔가가 잘못된거 같거든요.. 컴파일이 안되네염..
다중정의한 draw()쪽에서 문제가 있는거 같은데 몰겠습니다.^^
고수님 쫌만 도와주세염^^
#include<iostream.h>
class rectangle
{
private:
int itswidth;
int itsheight;
public:
rectangle(int width, int height);
~rectangle();
void draw() const ;
void draw(int awidth, int aheight) const;
};
rectangle::rectangle(int width, int height)
{
itswidth=width;
itsheight=height;
}
rectangle::~rectangle()
{}
void rectangle::draw() const
{
draw(itswidth, itsheight);
}
void rectangle::draw(int awidth, int aheight) const
{
for(int i=0;i<=aheight;i++)
{
for(int j=0;j<=awidth;j++)
{
cout <<"*";
}
cout<<endl;
}
return 0;
}
int main()
{
rectangle nagee(30,5);
cout<<"draw 30*5 \n";
nagee.draw();
cout<<"draw 40*2\n";
nagee.draw(40,2);
return 0;
}
|