Re: do need Interfaces for COM
From: Thomas Matthews (Thomas_MatthewsSpitsOnSpamBots_at_sbcglobal.net)
Date: Wed, 12 May 2004 13:03:19 GMT
> 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
> As far as i know Interfaces are nothing but placeholders for function
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:
> 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
> Thanks in advance
-- 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