25 June 2014

Can base/derived classes be exported to COM


  •  COM only deals with interfaces.   Base/derived classes have no meaning or functionality in COM.   Inheritance is not applicable either.
  • In COM, interfaces can inherit from one another.   However, the .NET implementation that exports the .NET interface to COM does not support inheritance.   Therefore, you must replicate any interface members in a base interface to the derived interface.
  • Moving members between a base and derived class will have no impact on what is visible to COM.
  • Only the programmer can define what is exposed to COM.   The complier will not use reflection or anything else to determine what should be exposed.
  • All COM classes have a single, default interface.   This is the interface that is normally used for an object.   A COM class can expose other interfaces but the COM client must then query for the interface.   In .NET the first COM visible interface is used as the default interface for a COM class. 


No comments: