Changes

Jump to: navigation, search

Components and Interfaces

878 bytes added, 20:41, 4 October 2006
Interface
=== Interface ===
There are two fundamental issues in component and interface-based programming, lifetime (aka object ownership) and interface querying (identifing components at run-time).
XPIDL defines tThese issues are addressed by the nsISupports interface that every XPCOM object should implement.  The following is a simple example of an implemented nsISupports interface for the class Sample.  class Sample: public nsISupports { private: nsrefcnt mRefCnt; public: Sample(); virtual ~Sample(); NS_IMETHOD QueryInterface(const nsIID &aIID, void **aResult); NS_IMETHOD_(nsrefcnt) AddRef(void); NS_IMETHOD_(nsrefcnt) Release(void); };  nsISupports interface is explained well [http://www.mozilla.org/projects/xpcom/book/cxc/html/quicktour2.html#1003494 here]. The nsISupports interface is similar to the Object and other run-time interfaces built into Java and .NET.
== Related Links ==
1
edit

Navigation menu