#include <iostream>

using namespace std;


class Rectangle {

public:

int width, height;

Rectangle();

Rectangle(int a, int b);

Rectangle(int c);


bool isSquare();

};


Rectangle::Rectangle() {

width = height = 1;

}


Rectangle::Rectangle(int a, int b) {

width = a, height = b;

}





Rectangle::Rectangle(int c) {

width = height = c;

}


bool isSquare() {

if (width == height) {

return true;

}

else return false;

}


int main() {

Rectangle rect1;

Rectangle rect2(3,5);

Rectangle rect3(3);


if (rect1.isSquare()) cout << "rect1은 정사각형이다" << endl;

if (rect2.isSquare()) cout << "rect1은 정사각형이다" << endl;

if (rect3.isSquare()) cout << "rect1은 정사각형이다" << endl;

}




이거 2010년대 초반 나온 책인데 지금 비쥬얼스튜디오에 그대로 치니까

문법오류뜨네요 ;;


Rectangle::isSquare() {

width = height = 1;

}


예를 들면 이 부분에서 Rectangle에 명시적형식이없음 int로 간주됨 이게 떠요