Click here to Skip to main content
15,885,365 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Friends,

I have to expose "ATL simple object" interface.

Now, I wanted to expose 3 interface objects. Each one has some common functionality, hence I am trying to keep common functionality in abstract class.

Now, my requirement is that each three class should have their own methods plus common functionilty [methods like Lock] inherited from common abstract base class.


Please suggest. Helpfull link would really help.
Posted

In addition to the references Pablo's given you have a look at "Essential COM" by Don Box. It's a bit dated but still the definitive tutorial on COM programming.

Another thing to watch out for... Implementation inheritance is the tightest form of coupling you can get between two classes. By giving classes a common base with any form of implementation you're coupling the base to all the derived classes AND each derived class to every other derived class. If you want to change an implementation of one of the derived classes then you might have to change the base class which means an implicit change to all the other derived classes.

If you want common functionality consider using free functions and/or a contained object to get the effect you want. It'll make your design less fragile.

PS: Just thought, ATL uses the Curiously Recursive Template pattern first documented by Jim Coplien in "The C++ Report" yonks ago. It's a key feature of ATL's architecture so it might be worth looking it up. In case you're wondering it's a way of call derived class functions from a base class without using virtual functions.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900