can u modify the abstract classes and interface.if modification is possible why allowed otherwise why not allowed RRS feed

  • Question

  • Hi,

       i read about interfaces and abstract classes in c#.i have doubt  about modification in interfaces and abstract classes.

    if modification is possible in both concepts why modification allowed otherwise why modification is not allowed

    Monday, February 19, 2018 11:29 AM

All replies

  • " have doubt  about modification in interfaces " 

    You're going to have to be more specific. 

    An interface is just a contract between 2 pieces of code that clarifies what functionality 1 piece will provide and what the other can use. You cannot alter a contract without invalidating both pieces of code. As such you generally don't modify interfaces.

    Abstract classes provide a partial implementation of something. Derived classes can add additional functionality. Abstract classes are preferred because new functionality can be added without breaking any existing code. Changes can also be made but may or may invalid existing code.

    Michael Taylor

    Monday, February 19, 2018 5:10 PM