객체지향프로그래밍

Major Study/Object Oriented Programming

객체지향 프로그래밍 프로젝트 (상속과 다형성, 가상함수) 해결 과정 / 가상 함수, 다형성 개념 정리

driver 파일 코드 설계는 다음과 같이 했다. #include using namespace std; #include #include "Shape.h" int main() { vector handle; // 핸들이 될 기본 클래스 포인터 자료형의 벡터 생성 handle[0] = new Circle; // 원 handle[1] = new Square; // 사각형 handle[2] = new Sphere; // 구면체 handle[3] = new Cube; // 정육면체 for (int i = 0; i < 4; i++) // handle 내의 도형을 처리하는 루프 { /* * if(handle[i]의 객체가 TwoDimesionalShape클래스의 파생 클래스 객체이면) cout

MINGYUM
'객체지향프로그래밍' 태그의 글 목록