|
안녕하세요~
클래스 상속을 통해 다른 기능을 더 갖는 클래스를 만들려고 합니다.
*대상: TTreeView
*시도:
class AppleTree: public TTreeView
{
public:
__fastcall AppleTree(TComponent * Owner);
__fastcall ~AppleTree();
};
//생성자
__fastcall AppleTree::AppleTree(TComponent* Owner) : TTreeView(Owner)
{
ShowMessage("ok");
};
//소멸자
__fastcall AppleTree::~AppleTree()
{
ShowMessage("no!");
};
이렇게 클래스를 상속 받았습니다..테스트를 위해 기능첨가는 없네요 ^^;
맞는지 모르겠네요..여기까진 컴파일 이상 없고 메소드도 다 포함하고 있더군요~
음..
문제는 이 새로 만든 클래스로 동적 생성을 할때 발생합니다.
*시도:
AppleTree * MyTree = new AppleTree(this);
MyTree->Left = 8;
MyTree->Top = 32;
MyTree->Width = 145;
MyTree->Height = 361;
MyTree->Indent = 19;
MyTree->TabOrder = 0;
//MyTree->ParentWindow = this->Handle;
이렇게 동적 생성을 했는데요...
컴파일도 되고..
동적생성이 될때..
에러가 발생합니다.
*에러
EInvalidOperation with message 'Control'' has no parent window'.
이런 에러가 발생하네요..
도움 부탁드리겠습니다!
그럼 좋은 하루 되세요!!
|