질문 올립니다! 답변 부탁해요~~~
이치코
문제가
기본 클래스 Point는 추상 클래스로 GetArea()를 멤버로 가지고 있다.
이것을 상속하여 int x, y 좌표와 GetArea()를 가지고 있는
Point2D 클래스와 int x, y, z 좌표와 GetArea()를 가지고 있는 Point3D 클래스를 정의한다.
GetArea()는 원점을 기준으로 사각형 면적과 육면체 부피를 계산하여 출력한다.
두 클래스 모두 x, y, z를 1, 2, 3으로 초기화하는 생성자를 만든다.
main()에서는 Point 클래스 객체 포인터를 이용하여 면적과 부피를 출력한다
이거인데요... 제가 만든게 이거고요
근데 실행이 안되요! 왜그런지요??
답변 부탁해요!!! 어디가 마무리가 안되서 그런지 좀 고쳐 주세요~!!
에러는 안뜨는데. 프로그램을 실행하려 하면 안되네요~
point.cpp파일이고요
#include iostream
using namespace std ;
#include point.h
Point::Point(int xx, int yy )
{
x = xx ;
y = yy ;
} void Point::GetArea()
{
return ;
} point2D.cpp파일이고요
#include point2D.h
using namespace std ;
Point2D::Point2D( int xx, int yy )
{
x = xx ;
y = yy ;
}
int Point2D::GetArea()
{
return x * y ;
}
point3D.cpp파일이고요
#include iostream
#include point3D.h
using namespace std ;
Point3D::Point3D(int xx, int yy, int zz )
{
z = zz ;
}
int Point3D::GetArea()
{
return x * y * z ;
}
test.cpp 파일이고요! #include iostream
#include point3D.h
using namespace std ;
int main()
{
Point3D p3;
//printf(면적 or 부피 : %d\n, p3.GetArea() );
cout 면적 아니면 부피 : \n;
return 0;
} point.h파일
#include iostream
class Point
{
public:
Point( int = 1, int = 2 );
void GetArea() ;
protected:
int x ;
int y ;
};
point2D.h 파일
#include point.h
class Point2D: public Point
{
public :
Point2D(int = 1 , int = 2) ;
int GetArea();
}; point3D.h파일!
#include point2D.h
class Point3D: public Point
{
public :
Point3D(int = 1, int = 2, int = 3);
int GetArea();
protected :
int z;
};