Click here to Skip to main content
15,899,025 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: AddRef and Release Pin
George_George3-Feb-08 19:23
George_George3-Feb-08 19:23 
GeneralRe: AddRef and Release Pin
CPallini3-Feb-08 22:39
mveCPallini3-Feb-08 22:39 
GeneralRe: AddRef and Release Pin
George_George3-Feb-08 22:46
George_George3-Feb-08 22:46 
GeneralRe: AddRef and Release Pin
CPallini3-Feb-08 22:56
mveCPallini3-Feb-08 22:56 
GeneralRe: AddRef and Release Pin
George_George3-Feb-08 23:04
George_George3-Feb-08 23:04 
GeneralRe: AddRef and Release Pin
CPallini3-Feb-08 23:34
mveCPallini3-Feb-08 23:34 
GeneralRe: AddRef and Release Pin
George_George3-Feb-08 23:50
George_George3-Feb-08 23:50 
GeneralCreateInstance Pin
George_George3-Feb-08 14:52
George_George3-Feb-08 14:52 
Hello everyone,


In the book "Inside COM", there is an interesting code segment like this,

IUnknown* CreateInstance()
{
    IUnknown* pI = static_cast <ix*> (new CA);
    pI -> AddRef();
    return pI;
}

// IX an interface is derived from IUnkown, IY is an interface derived from
// IUnknown and CA is a class directly derived from both IX and IY.
</ix*>


My question is, why static_cast <ix*> to result in IUnknown*? Why not static_cast <iunknown*> to result in IUnknown* to be more straightforward (even if I think using IX* and IUnknown* have the same effect)? Are there any reasons or advantages if we use IX* other than IUnknown*?


thanks in advance,
George
QuestionRe: CreateInstance Pin
CPallini3-Feb-08 21:52
mveCPallini3-Feb-08 21:52 
GeneralRe: CreateInstance Pin
George_George3-Feb-08 22:02
George_George3-Feb-08 22:02 
GeneralRe: CreateInstance Pin
CPallini3-Feb-08 22:08
mveCPallini3-Feb-08 22:08 
GeneralRe: CreateInstance Pin
George_George3-Feb-08 22:10
George_George3-Feb-08 22:10 
GeneralRe: CreateInstance Pin
CPallini3-Feb-08 22:19
mveCPallini3-Feb-08 22:19 
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 
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 

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.