rbulph Posted December 1, 2005 Posted December 1, 2005 Interfaces are a sort of contract which states that the implementing object must implement all methods of the interface. Fine. But at the next level up you might have several related interfaces, and want to have a contract that a dll will implement all of those interfaces, and do so just once. Can this be done? Or am I better thinking of having one big interface and somehow dividing the procedures in that into categories? Quote
Administrators PlausiblyDamp Posted December 1, 2005 Administrators Posted December 1, 2005 You could create an interface that inherits the other smaller interfaces and then have the class inside the dll implement that interface - that way it can still be used where ever any of the interfaces are required also. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
rbulph Posted December 1, 2005 Author Posted December 1, 2005 You could create an interface that inherits the other smaller interfaces and then have the class inside the dll implement that interface - that way it can still be used where ever any of the interfaces are required also. Yes, that's pretty good, thanks. It would still be quite neat if I could somehow prevent the interface from being implemented more than once in a dll, to avoid the confusion it would cause. But probably there's no easy way of doing that. Quote
bri189a Posted December 1, 2005 Posted December 1, 2005 Well you're not going to call functions on the DLL, you're going to call functions on a class in the DLL. Just don't put any other class' in the DLL that use the interface. Quote
Administrators PlausiblyDamp Posted December 2, 2005 Administrators Posted December 2, 2005 A dll is going to expose classes to other applications, it's these classes that implement the interface(s) not the DLL itself. Not sure how each class that is required to implement a particular interface actually implementing the interface is likely to cause confusion though... Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
rbulph Posted December 2, 2005 Author Posted December 2, 2005 A dll is going to expose classes to other applications, it's these classes that implement the interface(s) not the DLL itself. Not sure how each class that is required to implement a particular interface actually implementing the interface is likely to cause confusion though... If a dll implements the interface more than once in different classes then that's not what I would be expecting. But fine, it just means I have two plug-ins in the same dll, which is no great problem, true, I just have to write a little code for it. Quote
Cags Posted December 2, 2005 Posted December 2, 2005 If a dll implements the interface more than once A dll doesn't implement anything it's simply a library of classes. Any or all of the classes in the dll can implement the same interface. The fact that classes are all in the same dll doesn't link them in any way other than the fact that they are stored together. Quote Anybody looking for a graduate programmer (Midlands, England)?
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.