C2659 해결 질문
조회수 745회
#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;
}
이렇게 하면 함수가 왼쪽 피연산자로 사용했다고 뜨는데 어떻게 해야하죠?
-
(•́ ✖ •̀)
알 수 없는 사용자
댓글 입력