Click here to Skip to main content
15,909,498 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Suggestion to Chris Pin
CPallini4-Feb-08 0:03
mveCPallini4-Feb-08 0:03 
GeneralRe: non-pure virtual function in C++ interface Pin
toxcct4-Feb-08 1:57
toxcct4-Feb-08 1:57 
GeneralRe: non-pure virtual function in C++ interface Pin
George_George4-Feb-08 2:01
George_George4-Feb-08 2:01 
GeneralRe: non-pure virtual function in C++ interface Pin
toxcct4-Feb-08 2:09
toxcct4-Feb-08 2:09 
GeneralAddRef and Release Pin
George_George3-Feb-08 15:01
George_George3-Feb-08 15:01 
AnswerRe: AddRef and Release Pin
Lim Bio Liong3-Feb-08 19:15
Lim Bio Liong3-Feb-08 19:15 
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 

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.