Re: Why Cant we add a function to an existing Interface?




"Brian Muth" <bmuth@xxxxxxxx> wrote in message news:OTZWsUqKHHA.1248@xxxxxxxxxxxxxxxxxxxxxxx
By adding a function you are breaking binary compatibility. Basically you are changing the definition of the interface and interfaces are supposed to be immutable.

The reason this is important is that there may be a client that codes using your interface definition and calls the new function. However he is using the original component which doesn't have this function. Obviously his code is going to crash even though he has done nothing wrong; he has an expectation that the interface has been fully defined and implemented.


That's not entirely correct. VB will let you ADD properties and methods to the public interface without forcing you to break binary compatibility. You cannot modify or delete existing members of the public interface, however. Other languages might not be this lenient.

--
Mike
Microsoft MVP Visual Basic

.



Relevant Pages


Loading