Subj : bcb6 another inheritance bug To : borland.public.cpp.borlandcpp From : "Emile" Date : Mon Mar 08 2004 04:08 pm //-------------------------------------------------------------------------- - //UNIT1.H //-------------------------------------------------------------------------- - #ifndef Unit1H #define Unit1H #include #include #include #include #define MYBASE TObject class EmptyClass { public: int x; void EmptyFonction(void) {ShowMessage("ok");} }; class iclient_A { public: virtual void event_iclient_A(void) = 0; }; class iclient_B { public: virtual void event_iclient_B(AnsiString M) = 0; }; class client_A : public MYBASE, public iclient_A { public: void event_iclient_A(void) {ShowMessage("client_A::event_iclient_A");} }; class client_B : public client_A, public iclient_B { public: void event_iclient_B(AnsiString M) {ShowMessage(M);} }; class iserver_A { public: virtual void notify_iclient_A(iclient_A *p) = 0; }; class iserver_B { public: virtual void notify_iclient_B(iclient_B *p) = 0; }; class server_A : public MYBASE, public iserver_A { public: void notify_iclient_A(iclient_A *p) { p->event_iclient_A() ; } }; class server_B : public server_A, public iserver_B { public: void notify_iclient_B(iclient_B *p) { p->event_iclient_B("aaaa") ; } }; class TForm1 : public TForm { __published: // IDE-managed Components void __fastcall FormCreate(TObject *Sender); private: // User declarations public: // User declarations __fastcall TForm1(TComponent* Owner); }; extern PACKAGE TForm1 *Form1; #endif //-------------------------------------------------------------------------- - //UNIT1.CPP //-------------------------------------------------------------------------- - #include #pragma hdrstop #include "Unit1.h" #pragma package(smart_init) #pragma resource "*.dfm" TForm1 *Form1; __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { } void create(void) { client_B *cb; server_B *sb; cb = new client_B(); sb = new server_B(); sb->notify_iclient_A(cb); sb->notify_iclient_B(cb); delete sb, cb; } void __fastcall TForm1::FormCreate(TObject *Sender) { create(); } .