Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

COM and Intterfaces

Posted on 2006-11-12
3
Medium Priority
?
178 Views
Last Modified: 2010-04-01
Hello all,

Why is that when an interface is published and registered in the regsitry, that on subsequent releases that interface cannot be modified in any way? E.g if i were to add a new virtual method at the end of the current methods listed in the intterface?

Thanks
0
Comment
Question by:lcoolsingh
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 11

Expert Comment

by:Deepu Abraham
ID: 17928550
Hi,

Well you could very well add a new function in the interface.Only trouble is you need to re- compile the clients which are using that interface.

While designing the interface we should make sure that your interface should be furture proof.

If you understand the COM frame work, you will be able to connect it well.

Hope you got it !

Best Regards,
DeepuAbrahamK
0
 

Author Comment

by:lcoolsingh
ID: 17930158
I understand the COM framework, but say if you've added one method in your interface like this:

interface
{

  void print(int var);
};

You register this interface, and clients are using it. Six months down the line, you want to do this:

interface
{

  void print(const int var); //ADDED const
};

Why cant we do this? The interface is already registered on the client machine, so their is no need for registration.
0
 
LVL 11

Accepted Solution

by:
Deepu Abraham earned 150 total points
ID: 17933135
When you change your interface means you are changing your functions(adding/deleting/modifying) or even function signature.Your client only knows *void print(int var)* and not *void print(const int var)*.The call inside the client menthod may not know the new method *void print(const int var)*.So it will fail.Unless you break and repair the client to use *print(const int var)*.

Hope I get across!

Best Regards,
DeepuAbrahamK
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question