Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. COM Interview Question

COM Interview Question

Scheduled Pinned Locked Moved C / C++ / MFC
comoopquestionannouncementcareer
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Scorpio
    wrote on last edited by
    #1

    Suppose I derive Add and Multiply from IUnknown and then derive Calculator from Add and Multiply as shown below IUnknown IUnknown | | ADD Multiply \ / \ / Calculator then how many copies of (QueryInterface,AddRef, Release ) will be there in Calculator,If one then explain how. Prior to this question I had said that Multiple Inheritance has a disadvantage of name ambiguity.(hence above was the counter question by an interviewer)

    S 1 Reply Last reply
    0
    • S Scorpio

      Suppose I derive Add and Multiply from IUnknown and then derive Calculator from Add and Multiply as shown below IUnknown IUnknown | | ADD Multiply \ / \ / Calculator then how many copies of (QueryInterface,AddRef, Release ) will be there in Calculator,If one then explain how. Prior to this question I had said that Multiple Inheritance has a disadvantage of name ambiguity.(hence above was the counter question by an interviewer)

      S Offline
      S Offline
      Stephen Hewitt
      wrote on last edited by
      #2

      This question is not clear. In COM interfaces can only be derived from one base class. IUnkown is an interface. Calculator clearly isn't a COM interface as it uses multiple inheritance. This suggests that this is an implementation hierarchy: Calculator is a C++ class that is using multiple inheritance to implement COM interfaces. It's still not clear what ADD and Multiply are. Their names suggest they are not interfaces. This question is too vague. Steve

      S 1 Reply Last reply
      0
      • S Stephen Hewitt

        This question is not clear. In COM interfaces can only be derived from one base class. IUnkown is an interface. Calculator clearly isn't a COM interface as it uses multiple inheritance. This suggests that this is an implementation hierarchy: Calculator is a C++ class that is using multiple inheritance to implement COM interfaces. It's still not clear what ADD and Multiply are. Their names suggest they are not interfaces. This question is too vague. Steve

        S Offline
        S Offline
        Scorpio
        wrote on last edited by
        #3

        ADD and Multiply Are Interfaces

        S 1 Reply Last reply
        0
        • S Scorpio

          ADD and Multiply Are Interfaces

          S Offline
          S Offline
          Stephen Hewitt
          wrote on last edited by
          #4

          Then there is one implementation for each. This is how multiple inheritance works in C++. Steve

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups