[QT프로그래밍, GUI프로그래밍] QT그래픽- 도형그리기- 상속,배열이용, 모든 도형을 하나의 배열에 삽입하고 그 배열에서 꺼내어 도형을 그릴 수 있도록 구현
- 최초 등록일
- 2020.07.30
- 최종 저작일
- 2020.07
- 16페이지/ 한컴오피스
- 가격 2,000원
* 본 문서(hwp)가 작성된 한글 프로그램 버전보다 낮은 한글 프로그램에서 열람할 경우 문서가 올바르게 표시되지 않을 수 있습니다.
이 경우에는 최신패치가 되어 있는 2010 이상 버전이나 한글뷰어에서 확인해 주시기 바랍니다.
목차
1. 문제개요
2. 알고리즘
3. 프로그램 소스
4. 프로그램 실행화면
5. 프로젝트 후기
본문내용
문제개요
▲ 문제 내용
Design and implement a class hierarchy for two-dimensional shapes. Your hierarchy should include squares, rectangles, triangle, and circles, making Shape the topmost class in the heriarchy.
Interact with the user. Let the user specify the position, size, shape and fill characters to be used in drawing each shape. The user can specify more than one o the same shape. As you create each shape, place a Shape* pointer to each new Shape object into an array. Each Shape class should now have its own draw member function. Write a polymorphic screen manager that walks through the array, sending draw messages to each object in the array to from a screen image. Redraw the screen image each time the user specifies an additional shape.
▲ 문제 요점
○ 상속의 사용
- Super Class로 Shape(Figure)Class를 구현하고 Sub Class로 Square, Rectangle, Triangle, Circle Class를 구현
○ 도형의 성질
- 위치와 크기의 조절이 가능하도록 할 것.
○ 도형의 표현
- 모든 도형을 하나의 배열에 삽입하고 그 배열에서 꺼내어 도형을 그릴 수 있도록 구현할 것.
알고리즘
▲ 모양 Class의 상속을 사용한 구현
모든 도형이 공통적으로 지녀야 할 것으로는 도형의 위치와 크기를 나타내는 변수이다.
참고 자료
없음