locked
Implementing dll has not defined all the methods declared in the interface?? RRS feed

  • Question

  • Hi all,

    i have my application working as expected in the production.But we are trying to make the modules of the application as dll's so that it can be used wherever needed.

    And when i try to create the interface common for two dll's i am facing issue one of the implementing dll has not defined all the methods declared in the interface. Is it that the interface implementing clas library should define all parts of the interface?
    Is there any workaround for this?

    Can anyone please help me out with this?

    Thanks,

    Aish

    Thursday, December 29, 2011 10:48 AM

Answers

  • Yes.

    No: But you could reuse the interface just without fully implement the properties and methods ( the one you don`t need ). This just can lead to unexpected behaviour of the classes that would use your classes (with partly implemented inteface). But you just shouldn`t do this ;-)


    Hannes

    If you have got questions about this, just ask.

    In a perfect world,
    users would never enter data in the wrong form,
    files they choose to open would always exist
    and code would never have bugs.

    C# to VB.NET: http://www.developerfusion.com/tools/convert/csharp-to-vb/
    • Marked as answer by IshNair Monday, January 2, 2012 7:21 AM
    Thursday, December 29, 2011 12:46 PM

All replies

  • Aish,

    see an interface like a contract. If a class implements a interface it need`s to implement all the methods and properties the interface specifies. Otherwise the class would break the contract.


    Hannes

    If you have got questions about this, just ask.

    In a perfect world,
    users would never enter data in the wrong form,
    files they choose to open would always exist
    and code would never have bugs.

    C# to VB.NET: http://www.developerfusion.com/tools/convert/csharp-to-vb/
    • Proposed as answer by Konrad Neitzel Thursday, December 29, 2011 11:00 AM
    Thursday, December 29, 2011 10:58 AM
  • OKay then it means that i cannot reuse the interface among the implementing classes say if i need to implement only a part of the interface.
    Is my understanding correct?
    Thursday, December 29, 2011 12:37 PM
  • Yes.

    No: But you could reuse the interface just without fully implement the properties and methods ( the one you don`t need ). This just can lead to unexpected behaviour of the classes that would use your classes (with partly implemented inteface). But you just shouldn`t do this ;-)


    Hannes

    If you have got questions about this, just ask.

    In a perfect world,
    users would never enter data in the wrong form,
    files they choose to open would always exist
    and code would never have bugs.

    C# to VB.NET: http://www.developerfusion.com/tools/convert/csharp-to-vb/
    • Marked as answer by IshNair Monday, January 2, 2012 7:21 AM
    Thursday, December 29, 2011 12:46 PM
  • Ok:) Thanks for your support
    Monday, January 2, 2012 7:21 AM