do need Interfaces for COM

V

vimal

Hi ,

I am currently learning COM using c++. Just when I completed the
chapter about Interfaces in Dale Rogerson's Inside COM, i got a basic
question in my mind.
Why do we need Interfaces?? Cant we achieve what Interfaces do by just
exported functions?

As far as i know Interfaces are nothing but placeholders for function
pointers. If this is true why not the QueryInterface function return
the Function pointers instead of Interface pointers??

I appreciate any light on this thought .

Thanks in advance
Vimal
 
T

Thomas Matthews

vimal said:
Hi ,

I am currently learning COM using c++. Just when I completed the
chapter about Interfaces in Dale Rogerson's Inside COM, i got a basic
question in my mind.
Why do we need Interfaces??

Interfaces tell how to use a component, whether that component be a
library, function, module or piece of hardware.

Cant we achieve what Interfaces do by just exported functions?

A cleaner method is to have all the interfaces in one place and include
them where you need them. There should be no execution cost for
including unused definitions. Placing "extern" or single function
declarations around the code prompts one to ask, "why wasn't the
entire package included" or perhaps, "what other information surrounds
these definitions?"

As far as i know Interfaces are nothing but placeholders for function
pointers.

Interfaces are more than that. According to Bertand Meyer from
"Object-oriented Software Construction", there is more to an
interface than just function declarations or place holders.
Here are some attributes of an interface:
Description
Input list
Output list
Behavior
Side-effects
Pre-Conditions
Post-Conditions
Dependencies

If this is true why not the QueryInterface function return
the Function pointers instead of Interface pointers??

Sorry, but there is no QueryInterface in the _standard_
C++ language, which is discussed in this newsgroup. Perhaps
you meant to post to a newsgroup that deals with COM interfaces.

I appreciate any light on this thought .

I would read the FAQs and welcome.txt of newsgroups before
posting to them. Searching them first before posting is
highly recommended.

Thanks in advance
Vimal


--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.raos.demon.uk/acllc-c++/faq.html
Other sites:
http://www.josuttis.com -- C++ STL Library book
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,169
Messages
2,570,919
Members
47,458
Latest member
Chris#

Latest Threads

Top