Interviews5 answers
Difference between Abstract class and Interface?
5 Answers
Interface acts as a contract(all the methods should be implemented in derived class.)
Abstract--> atleast one method should be implemented.
Sreekanth ReddyPosted Jul 10, 2015, 11:06 PM EDT
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.
Posted Jan 21, 2015, 2:51 AM EST
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 specifiers
abstract class have implementation. it has access specifiers and can inherits from base class and interface.
Mahesh Kumar AlankaPosted Apr 25, 2014, 9:41 PM EDT
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 SharmaPosted Apr 12, 2014, 1:08 AM EDT
For Abstract class Visit:-
http://www.dotnet-tricks.com/Tutorial/csharp/E0K2011113-A-Deep-Dive-into-C
And For Interface Visit:-
http://www.dotnet-tricks.com/Tutorial/csharp/5T27291013-A-Deep-Dive-into-C
Yogesh TyagiPosted Apr 7, 2014, 11:06 PM EDT




