Whats is Class And Interface in .NET and there difference?

Report
Question

Please briefly explain why you feel this question should be reported .

Report
Cancel

About class and interface in dot net.

in progress 0
.NET sonam777 4 months 1 Answer 92 views 0

Answer ( 1 )

  1. Singh_Sima

    Please briefly explain why you feel this answer should be reported .

    Report
    Cancel

    Abstract Classes :
    Abstract classes are closely related to interfaces. They are classes that cannot be instantiated, and are frequently either partially implemented, or not at all implemented. One key difference between abstract classes and interfaces is that a class may implement an unlimited number of interfaces, but may inherit from only one abstract (or any other kind of) class. A class that is derived from an abstract class may still implement interfaces.
    Abstract classes are useful when creating components because they allow you specify an invariant level of functionality in some methods, but leave the implementation of other methods until a specific implementation of that class is needed.
    Interface :
    Interface is a type which contains only the signatures of methods, delegates or events, it has no implementation.
    Implementation of the methods is done by the class that which implements the interface.

    Interface is a contract that defines the signature of the functionality. So if a class is implementing a interface it says to the outer world, that it provides specific behavior. Example if a class is implementing ‘Idisposable’ interface that means it has a functionality to release unmanaged resources.

    About Abstract Class :
    Abstract class is a class that contain complete and abstract (incomplete) both type of member and it can not be instantiated, Abstract classes are one of the essential behaviors provided by dotnet.
    Interface contains only definition / signature of functionality, and if we have some common functionality as well as common signature then there is a need of abstract class so through abstract class we can provide behavior as well as functionality both in the same time, developer inheriting abstract class can use this functionality and need to fill only in the blank.
    About Interface :
    Interface is a type which contains only the signatures of methods, delegates or events, it has no implementation, Implementation of the methods is done by the class that which implements the interface.
    Interface is a contract that defines the signature of the functionality. So if a class is implementing a interface it says to the outer world, that it provides specific behavior. Example if a class is implementing ‘Idisposable’ interface that means it has a functionality to release unmanaged resources.

Leave an answer

Browse

Captcha Click on image to update the captcha .

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>