Solved

COM and Intterfaces

Posted on 2006-11-12
3
171 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
  • 2
3 Comments
 
LVL 11

Expert Comment

by:DeepuAbrahamK
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:
DeepuAbrahamK earned 50 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
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 goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
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.

863 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now