Subj : resolve this bug plz To : borland.public.cpp.borlandcpp From : "Emile" Date : Wed Mar 17 2004 04:57 pm /* never called (just a random call to another function in base class): sb->notify_iclient_B(cb); general description of this inheritance problem : class x : public tobject class y : public x, public interfaceA class z : public y, public interfaceB results : impossible to call methods of interfaceB. just a random wrong call to class Y. If you add multiple parameters to interfaces functions, the stack are never cleared and bcb crash. in pure c++, that run good. but, with vcl/tobject and stacked inheritance of interfaces, its impossible to execute functions call. Its normal? see the code : */ //-------------------------------------------------------------------------- - //UNIT1.H //-------------------------------------------------------------------------- - #ifndef Unit1H #define Unit1H #include #include #include #include #define MYBASE TObject class EmptyClass { public: void EmptyFonction(void); }; 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 iclient_B { public: void event_iclient_A(void); }; class client_B : public client_A { public: void event_iclient_B(AnsiString 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 iserver_B { public: void notify_iclient_A(iclient_A *p); }; class server_B : public server_A { public: void notify_iclient_B(iclient_B *p); }; 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 __fastcall TForm1::FormCreate(TObject *Sender) { 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 EmptyClass::EmptyFonction(void) { ShowMessage("ok"); } void client_A::event_iclient_A(void) { ShowMessage("client_A::event_iclient_A"); } void client_B::event_iclient_B(AnsiString M) { ShowMessage(M); } void server_A::notify_iclient_A(iclient_A *p) { p->event_iclient_A() ; } void server_B::notify_iclient_B(iclient_B *p) { p->event_iclient_B("aaaa"); } .