In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] says...
> Why does Mozilla use XPCOM? A while ago, I read a message in this
> newsgroup indicating that XPCOM's purpose was to allow one to create
> components, accessible through interfaces. I agree that this scheme
> is good, but one can accomplish this goal using standard abstraction
> techniques in standard C and C++. Can someone explain the benefits of
> XPCOM?
In classical C++ the compiler is the one, who performs typecast from one
class to anoterh. Imagine following:
class Alpha { };
class Bravo { };
class Charly : public Alpha, public Bravo { }
in this case anything that accept Alpha, Bravo or Charly could get Charly
as an argument
in (XP)COM typecasting is performed by the object itself. In simple words,
this mean that all interfaces are derived from a base common interface -
nsISupoprts in XPCOM, IUnknown in COM. Whenever you need something, you ask
a standard nsISupports/IUnknown method, QueryInteface() for a pointer of
specific type.
This makes things very flexible. Beside, a specific implementation of an
object, could implement several interfaces, so there is very good bakward
compatibility.
In other words, (XP)COM perform object cast at runtime, and "classic" C++
object is casted at compile time. This means that whenever you got new
version of DLL, you need to recompile your sources too. In XPCOM it is
usually not required - if DLL is backword compatible it will create an
object for you, that support both older and newer thing
Hope this helps
--
--
Regards,
Waleri