Click here to Skip to main content
15,897,891 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: CreateInstance Pin
George_George3-Feb-08 22:25
George_George3-Feb-08 22:25 
GeneralRe: CreateInstance Pin
CPallini3-Feb-08 22:35
mveCPallini3-Feb-08 22:35 
GeneralRe: CreateInstance Pin
George_George3-Feb-08 22:40
George_George3-Feb-08 22:40 
GeneralRe: CreateInstance Pin
CPallini3-Feb-08 22:52
mveCPallini3-Feb-08 22:52 
GeneralRe: CreateInstance Pin
George_George3-Feb-08 23:01
George_George3-Feb-08 23:01 
GeneralRe: CreateInstance Pin
CPallini3-Feb-08 23:33
mveCPallini3-Feb-08 23:33 
GeneralRe: CreateInstance Pin
George_George3-Feb-08 23:53
George_George3-Feb-08 23:53 
GeneralRe: CreateInstance Pin
CPallini4-Feb-08 0:13
mveCPallini4-Feb-08 0:13 
George_George wrote:
No matter whether they contain data member, right?

Yes, if compiler cannot exploit abstract nature of classes.


George_George wrote:
I do not quite understand your statement above. Could you show some pseudo code please?

Yes, suppose (the example is naive, but you'll probably get the idea):

class IX: public IUnknown
{
...
virtual ULONG AddRef(){ return ++m_nRef;}
...
};

class IY: public IUnknown
{
...
virtual ULONG AddRef(){ return 1;}
...
};


void main()
{
  IUnknown *pUnk = new CA;

  int n = pUnk->AddRef();
}


what will be (if the above code compiles) n value?


Smile | :)

If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.

[my articles]


GeneralRe: CreateInstance Pin
George_George4-Feb-08 0:34
George_George4-Feb-08 0:34 
GeneralRe: CreateInstance Pin
CPallini4-Feb-08 1:47
mveCPallini4-Feb-08 1:47 
GeneralRe: CreateInstance Pin
George_George4-Feb-08 1:48
George_George4-Feb-08 1:48 
GeneralThanks Pin
CPallini4-Feb-08 2:00
mveCPallini4-Feb-08 2:00 
QuestionLost Helpfiles Pin
Bram van Kampen3-Feb-08 13:22
Bram van Kampen3-Feb-08 13:22 
Generalmake an Mdiform transparent Pin
diddy343-Feb-08 11:57
diddy343-Feb-08 11:57 
GeneralTransparent MDIform Pin
diddy343-Feb-08 11:49
diddy343-Feb-08 11:49 
GeneralRe: Transparent MDIform Pin
Mark Salsbery3-Feb-08 12:10
Mark Salsbery3-Feb-08 12:10 
General2 Rows in CListCtrl Header Pin
AnTri3-Feb-08 9:01
AnTri3-Feb-08 9:01 
Generalbinary to GdiPlus::Image Pin
followait3-Feb-08 7:02
followait3-Feb-08 7:02 
GeneralRe: binary to GdiPlus::Image Pin
Mark Salsbery3-Feb-08 7:41
Mark Salsbery3-Feb-08 7:41 
GeneralRe: binary to GdiPlus::Image [modified] Pin
followait3-Feb-08 21:16
followait3-Feb-08 21:16 
GeneralI can't modify the former msg, the 'edit' button is out of the view Pin
followait3-Feb-08 23:03
followait3-Feb-08 23:03 
GeneralRe: binary to GdiPlus::Image Pin
Mark Salsbery4-Feb-08 5:33
Mark Salsbery4-Feb-08 5:33 
GeneralRe: binary to GdiPlus::Image Pin
bob169723-Feb-08 9:05
bob169723-Feb-08 9:05 
GeneralRe: binary to GdiPlus::Image Pin
bob169723-Feb-08 9:13
bob169723-Feb-08 9:13 
GeneralDLL Function call Pin
ginjikun3-Feb-08 1:09
ginjikun3-Feb-08 1:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.