A: IparentInterface;
B: IchildInterface;
This code will generate error:
B: = IchildInterface (A); ==> will generate expected error whenever we access to B. At the time we down-cast A, we do not have exception.
The correct code should be:
A.QueryInterface (IchildInterface, B);
So the lesson here: Always use QueryInterface when you want to access other inteface of the same object. Do not cast Interface except you really know what you do.
Monday, January 21, 2008
How to use interface correctly?
Posted by CABA LAM at 9:59 PM
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment