Click here to Skip to main content
15,912,578 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: type safe issue Pin
CPallini11-Feb-08 3:20
mveCPallini11-Feb-08 3:20 
GeneralRe: type safe issue Pin
Rajkumar R11-Feb-08 3:26
Rajkumar R11-Feb-08 3:26 
GeneralRe: type safe issue Pin
CPallini11-Feb-08 3:41
mveCPallini11-Feb-08 3:41 
GeneralRe: type safe issue Pin
Rajkumar R11-Feb-08 3:54
Rajkumar R11-Feb-08 3:54 
QuestionRe: type safe issue Pin
CPallini11-Feb-08 4:10
mveCPallini11-Feb-08 4:10 
GeneralRe: type safe issue Pin
Rajkumar R11-Feb-08 4:12
Rajkumar R11-Feb-08 4:12 
QuestionRe: type safe issue Pin
CPallini11-Feb-08 5:11
mveCPallini11-Feb-08 5:11 
GeneralRe: type safe issue [modified] Pin
Matthew Faithfull11-Feb-08 3:28
Matthew Faithfull11-Feb-08 3:28 
Rajkumar R wrote:
But calling interface function of IX with IX * with the address of IY * is not valid.


It is when both are gaurenteed to be derived from IUnknown and by the rules of COM you can only call the members of IUnknown until you have queired the validity of the interface you really want by calling QueryInterface. A properly written client will not call any method other than IUnknown methods until it has a result from QueryInterface so you can go right ahead and use your IX* or IY*, when you QueryInterface for the interface you actaully want the COM server can say NO, then it is invalid to make the call you want. The address of IX* and the address of IY* are interchangable up to this point, they are both treated as type IUnknown** regardless and this does not cause any issues other than possible programmer confusion. It is type correct as far as any machine can possibly tell.


Rajkumar R wrote:
it won't compile, if you pass IY * in place of IX *.


If the compiler did that then it would not let you pass a CMyDocument* to a function taking a CDocument* that only operates on CObject members and that would make life very difficult Smile | :)
You might want to research into the Ada language if you want to live with those sort of restrictions.

Nothing is exactly what it seems but everything with seems can be unpicked.

modified on Monday, February 11, 2008 9:39 AM

GeneralRe: type safe issue [modified] Pin
Rajkumar R11-Feb-08 3:52
Rajkumar R11-Feb-08 3:52 
GeneralRe: type safe issue Pin
Matthew Faithfull11-Feb-08 4:29
Matthew Faithfull11-Feb-08 4:29 
GeneralRe: type safe issue [modified] Pin
Rajkumar R11-Feb-08 4:34
Rajkumar R11-Feb-08 4:34 
GeneralRe: type safe issue Pin
Matthew Faithfull11-Feb-08 4:54
Matthew Faithfull11-Feb-08 4:54 
GeneralRe: type safe issue Pin
Rajkumar R11-Feb-08 5:04
Rajkumar R11-Feb-08 5:04 
GeneralRe: type safe issue Pin
Matthew Faithfull11-Feb-08 5:20
Matthew Faithfull11-Feb-08 5:20 
GeneralRe: type safe issue Pin
Rajkumar R11-Feb-08 5:25
Rajkumar R11-Feb-08 5:25 
GeneralRe: type safe issue Pin
led mike11-Feb-08 4:46
led mike11-Feb-08 4:46 
GeneralRe: type safe issue Pin
Matthew Faithfull11-Feb-08 4:58
Matthew Faithfull11-Feb-08 4:58 
GeneralRe: type safe issue Pin
Rajkumar R11-Feb-08 5:18
Rajkumar R11-Feb-08 5:18 
QuestionRe: type safe issue Pin
CPallini11-Feb-08 5:26
mveCPallini11-Feb-08 5:26 
GeneralRe: type safe issue Pin
Rajkumar R11-Feb-08 5:30
Rajkumar R11-Feb-08 5:30 
GeneralRe: type safe issue Pin
CPallini11-Feb-08 5:35
mveCPallini11-Feb-08 5:35 
GeneralRe: type safe issue Pin
Rajkumar R11-Feb-08 5:42
Rajkumar R11-Feb-08 5:42 
GeneralRe: type safe issue Pin
CPallini11-Feb-08 10:39
mveCPallini11-Feb-08 10:39 
GeneralRe: type safe issue Pin
Rajkumar R11-Feb-08 16:18
Rajkumar R11-Feb-08 16:18 
GeneralRe: type safe issue Pin
Matthew Faithfull11-Feb-08 6:04
Matthew Faithfull11-Feb-08 6:04 

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.