I don't think COM supports overriding.
Defining classes exactly how TlbImp does can be tricky (and sometimes
impossible without using IL Assembler), but fortunately it's not really
required. The simple way to define such a class in C# is to make it empty,
implement no interfaces, but mark it with ComImportAttribute and
GuidAttribute. The attributes make the CLR perform the appropriate
CoCreateInstance when you instantiate the class, and casts to interfaces
will perform the appropriate QueryInterface calls. If you mark your
"default interface" with the CoClassAttribute, you can make the experience
even more seemless to clients of your class.
Hope that helps,
Adam
--------------------
>From: "Jeremy Chapman" <NoSpam@Please.com>
>References: <OrN3e6WzEHA.3708@TK2MSFTNGP14.phx.gbl>
[quoted text clipped - 9 lines]
>NNTP-Posting-Host: mail.interiorhealth.ca 204.239.148.2
>Path:
cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09
phx.gbl
>Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.framework.clr:12331
>X-Tomcat-NG: microsoft.public.dotnet.framework.clr
[quoted text clipped - 22 lines]
>>
>> Nathan
Nathan Baulch - 16 Dec 2004 05:41 GMT
Thanks so much for the info, everything seems to be working now.
I always wondered what the CoClassAttribute was and why TlbImp wrapped
classes could be referenced in two ways (TheObject or TheObjectClass)
interchangeably.
Never again will my CoClasses explicitly implement my COM interfaces!
Nathan
> Defining classes exactly how TlbImp does can be tricky (and sometimes
> impossible without using IL Assembler), but fortunately it's not
[quoted text clipped - 9 lines]
> Hope that helps,
> Adam