C2659 해결 질문

조회수 742회
#include <iostream>
using namespace std;

class Rectangle {
int width, height;
public:
Rectangle();
Rectangle(int, int);
int getWidth() { return width; }
int getHeight() { return height; }
int area(void) { return (width*height); }
};
Rectangle::Rectangle() {
width = 5;
height = 5;
}
Rectangle::Rectangle(int a, int b) {
width = a;
height = b;
}
int main() {
Rectangle r;
Rectangle *p;
p = &r;
r.getWidth = 2;
r.getHeight = 4;

cout << p->getWidth() << endl;
cout << p->getHeight() << endl;
}

이렇게 하면 함수가 왼쪽 피연산자로 사용했다고 뜨는데 어떻게 해야하죠?

  • (•́ ✖ •̀)
    알 수 없는 사용자

1 답변

답변을 하려면 로그인이 필요합니다.

프로그래머스 커뮤니티는 개발자들을 위한 Q&A 서비스입니다. 로그인해야 답변을 작성하실 수 있습니다.

(ಠ_ಠ)
(ಠ‿ಠ)