Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ ATL
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 21-May-12 1:03am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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.
  Permalink  
v2

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 555
1 Kornfeld Eliyahu Peter 409
2 Maciej Los 369
3 DamithSL 196
4 OriginalGriff 188
0 OriginalGriff 6,353
1 DamithSL 4,854
2 Maciej Los 4,466
3 Kornfeld Eliyahu Peter 4,058
4 Sergey Alexandrovich Kryukov 3,897


Advertise | Privacy | Mobile
Web01 | 2.8.141220.1 | Last Updated 21 May 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100