Subj : how to implement inheriting when embedding? To : netscape.public.mozilla.jseng From : "han" Date : Wed Jan 15 2003 09:27 am hi, confused again when embedding:( . our project works like this: first, we got an .xml file which describes the user interface(window,ctrls,etc.),a UI builder build up the UI based on the .xml and implement the default action(such as button's default behavior when clicked).When an event of a ctrl is triggerd, more actions'll be taken if some javascript event handler code is bind to the ctrl. the UI builder is write in C++ on win32. the problem is: how to implement the inheriting relation according to the UI's ( CButton->CWnd for example )? i know i can use prototype: //... function base(){...}// |base| ctrl in UI function derived(){...}// |derived| ctrl in UI derived.prototype=new base;// |derived|->|base| //... that is, when meet a |derived| ctrl ,the UI builder will do : js_derived=JS_NewObject(JSContext *cx, JSClass *clasp, JSObject *proto, JSObject *parent);then set the |derived| ctrl as the private data of js_derived. before that , the JSObject* proto is constructed based on the |base| ctrl.Should i set the |derived| ctrl as the private data of the proto? does it matter if all the deriveds share the same base here? any suggestion is appreciated. /han .