|
질문의 요지가
'생성자에서 상속받은 멤버의 초기화를 어떻게 하냐?' 이라면
대답은 간단합니다.
'멤버 초기화 리스트를 사용하여라'
입니다.
문허니 님이 쓰신 글 :
: 갑자기 복사생성자의 방법이 생각이 안나서 이렇게 글 씁니다.
:
: class GraphicsPath1 : public GrapihcsPath
: {
: GraphicsPath1();
: GraphicsPath1(const GraphicsPath1&);
: ~GraphicsPath1();
:
: GraphicsPath1* Clone();
: };
:
: GraphicsPath1::GraphicsPath1(const GraphicsPath1&)
: {
: // GraphicsPath1 속성 전달
: // ?? 상속한 GraphicsPath의 내용은 어떻게 복사하지요?
: }
:
: GraphicsPath1* GraphicsPath1::Clone()
: {
: return new GraphicsPath1(*this);
: }
:
:
: 대충 이렇게 되었을때, GraphicsPath를 상속받아서 사용하는데, GraphicsPath의 Clone을 하지 못하네요
: 그래서 전달이 잘 안되는데, 어떻게 하면 상속한 GraphicsPath 내용도 Clone할 수 있는지요..
|