【 tulaoshi.com - 编程语言 】
                             
                              以下不完整例子为生成一个TMemo的派生类及动态地创建该VCL控件。   
  Class TMemoEx : public TMemo 
  { 
  . 
  . 
  } 
  extern TMemoEx memoex;   
  Class TForm1 : Class TForm 
  { 
  public: 
  TMemoEx *MemoEx; 
  . 
  . 
  }   
  void _fastcall TForm1::FormShow(TObject *Sender) 
  { 
  MemoEx=new TMemoEx(this); 
  MemoEx-Parent=this; 
  . 
  . 
  } 
  总之,遵循以下步骤即可: 
  类定义; 
  extern TMemoEx memoex; 
  TMemoEx *MemoEx; 
  MemoEx=new TMemoEx(this); 
  MemoEx-Parent=this;