C++Builder Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
C++빌더 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
메신저 프로젝트
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
볼랜드포럼 광고 모집

C++빌더 Q&A
C++Builder Programming Q&A
[49520] 프로그램 한번 짜 봤는데 봐주세요!! 에러가 계속 나네요~
홍순규 [kinghong] 942 읽음    2007-06-03 01:08
c++로 한건데...

문제는 이거고요..

기본 클래스 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;
};


이렇게 파일을 나눠서 만들고 합쳐서 했는데
실행이 안되네요..
왜그런지요?^^
마무리좀 도와주세요~~~

+ -

관련 글 리스트
49520 프로그램 한번 짜 봤는데 봐주세요!! 에러가 계속 나네요~ 홍순규 942 2007/06/03
49521     Re:프로그램 한번 짜 봤는데 봐주세요!! 에러가 계속 나네요~ 아루스 961 2007/06/03
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.