Solved

COM and Intterfaces

Posted on 2006-11-12
3
172 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
What does std::atomic give me? 7 124
Lambda for random numbers problem 7 113
Dynamically allocate memory 9 58
designing in object programming 12 77
Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

772 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