5
Reply

Difference between Abstract class and Interface?

Renjith V S

Renjith V S

10 years ago
4.1k
0
Reply

    Interface acts as a contract(all the methods should be implemented in derived class.) Abstract--> atleast one method should be implemented.

    Srikanth Reddy
    9 years ago
    0

    Abstract Class: 1. Can have implementation and only signature of methods. 2. Allow access modifier e.g. Private, Protected, Public. 3. Does not force to inherited class to implement all the methods of abstract class. 4. Can have variables also. Interface : 1. Has only method signature. 2. All the methods inside interface are Public by default, does not allow private methods. 3. If a class implement an interface then interface force to class to implement it's all methods. 4. Does not allow variable inside it. 5. class can implement more then one interface.

    arvind
    9 years ago
    0

    interface doesn't have any implementation. it just have a signature of the method. it solves Multiple Inheritence Ambiguity problem. it doesn't have access specifiersabstract class have implementation. it has access specifiers and can inherits from base class and interface.

    Abstract Class V/s Interface (http://dotnet-munesh.blogspot.in/2013/12/difference.html)Abstract class can have implementation for some of its method. But the interface can't have implementation for any of its method.Abstract class can have field but interface does not have fields. An Interface can inherit from another interface only can't inherit from another abstract class but an abstract class can inherit from another abstract class and another interface. Abstract class members can have access modifiers where interface member doesn't have access modifiers.

    Munesh Sharma
    10 years ago
    0

    For Abstract class Visit:- http://www.dotnet-tricks.com/Tutorial/csharp/E0K2011113-A-Deep-Dive-into-CAnd For Interface Visit:- http://www.dotnet-tricks.com/Tutorial/csharp/5T27291013-A-Deep-Dive-into-C

    Yogesh Tyagi
    10 years ago
    0