using
我一直在谷歌搜索,即使我使用该指令,也找不到可以消除警告的解决方案。
class TShowException_Form : public TForm {
__published: // IDE-managed Components
TButton *Send_Button;
TButton *Cancel_Button;
TLabel *Message_Label;
private: // User declarations
using TCustomForm::ShowModal;
//using TForm::ShowModal;
public: // User declarations
__fastcall TShowException_Form(TComponent* Owner);
int __fastcall ShowModal(System::Sysutils::Exception *E);
};
我想隐藏原始virtual int __fastcall ShowModal(void)
文件并公开一个带有 Exception 参数的新文件。
但它仍然抱怨“隐藏虚拟功能”:
[bcc32 Warning] TShowExceptionForm.h(32): '_fastcall TShowException_Form::ShowModal(Exception *)' hides virtual function '_fastcall TCustomForm::ShowModal()'
我也尝试过using TForm::ShowModal;
,但结果相同。有关如何解决此警告的任何想法?
编辑
我发现如果我重写该show()
方法,它会非常有效:
class TShowException_Form : public TForm {
__published: // IDE-managed Components
TButton *Send_Button;
TButton *Cancel_Button;
TLabel *Message_Label;
private: // User declarations
using TForm::ShowModal;
using TForm::Show;
public: // User declarations
__fastcall TShowException_Form(TComponent* Owner);
int __fastcall Show(System::Sysutils::Exception *E);
};
那么为什么不使用ShowModal()
呢?