Duncan3142
Duncan3142

Reputation: 371

What is the difference between COM Classes and CoClasses

The Wikipedia COM article is vague when it comes to this issue.

Can anybody give an explanation that would be suitable for a COM beginner, or article link(s) providing the same.

Upvotes: 3

Views: 2357

Answers (3)

Vic
Vic

Reputation: 547

To answer your exact question, coclass stands for "component object class"; it is the same thing as "COM class". Your Wikipedia link answers this exactly:

A COM class (coclass) is...

Upvotes: 0

Roman Ryltsov
Roman Ryltsov

Reputation: 69716

coclass is nothing but a type library declaration of a class. There are no assumptions on interfaces implemented by a class (other than perhaps IUnknown, or the class makes no sense), however if a declaration references certain interfaces within the type library, it is expected that real instance would implement those.

Upvotes: 1

Thorsten Dittmar
Thorsten Dittmar

Reputation: 56727

It helped me to think about it the following way:

A COM class to me is an instance of a class that implements a certain interface. I don't need to know how the implementation is done, as long as it works as expected. Also, a COM class is not language dependent - it's a description of methods.

A Co-Class is an actual implementation that gets instantiated when requesting a COM class.

For example: A COM class could define method to encrypt or decrypt data. There could be two Co-Classes, each for a special encryption algorithm.

Upvotes: 1

Related Questions