#include <iostream>
using namespace std;
class Rectangle;
int main(){
Rectangle myRoom(5,10);
cout << myRoom.getHeight() << endl;
cout << myRoom.getLength() << endl;
system("pause");
return 0;
}
class Rectangle{
private:
int height;
int length;
public:
Rectangle(int aHeight, int aLength){
height = aHeight;
length = aLength;
}
int getHeight(){
return height;
}
int getLength(){
return length;
}
};
Compiler は、Rectangle、getHeight、および getLength が未定義であることを教えてくれます。私のクラス Rectangle がプロトタイピングされていないのはなぜですか? 誰かが私が間違っていることを教えてもらえますか? ありがとうございました。