Re: do need Interfaces for COM

From: Thomas Matthews (Thomas_MatthewsSpitsOnSpamBots_at_sbcglobal.net)
Date: 05/12/04


Date: Wed, 12 May 2004 13:03:19 GMT

vimal wrote:

> 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


Relevant Pages

  • Re: RFD: Interface with Moderated Newsgroups
    ... This RFD seeks to document the technical interfaces ... This is the email address to which submissions to the newsgroup are sent. ... How would the moderator then determine if the message was intended for posting to the ng, or whether it was just an email to the moderators? ... The committee oversees the management of the usenet.org.uk mail server, ...
    (uk.net.news.management)
  • Re: Databinding an Klasse
    ... Huber Christian wrote: ... Eine kleine Recherche in den Beiträgen der Newsgroup ... Um welches Control handelt es sich denn? ... Welche Interfaces erfordert das ...
    (microsoft.public.de.german.entwickler.dotnet.vb)
  • Re: Custom Data Provider for .NET
    ... you can create business classes that provide the data interfaces for ... Please reply only to the newsgroup so that others can benefit. ... "database" that consists of essentially flat files (with no relations ... interfaces I must implement?. ...
    (microsoft.public.data.ado)
  • Re: is avoiding compat ioctls possible?
    ... If you use pointers in your interfaces in any way, ... a u32 inside of the drm_radeon_info structure for the kernel ... Please read the FAQ at http://www.tux.org/lkml/ ...
    (Linux-Kernel)
  • Re: 30 amps on a 12 v rail
    ... The interfaces provided by Google and Yahoo and the like are quite ... Outlook Express has a newsgroup interface, ... you get personally offended when i call yur usenet google ...
    (alt.comp.hardware.pc-homebuilt)