What is the difference between Abstract and Interface?
Answers were Sorted based on User's Feedback
Answer / vishal singh
In an interface class, all methods are abstract - there is
no implementation. In an abstract class some methods can
be concrete - there can be implementation. In an interface
class, no accessibility modifiers are allowed - are public
by default. In an abstract class accessibility modifiers
are allowed.
Is This Answer Correct ? | 146 Yes | 18 No |
Answer / anand
Abstract Class:
1. Abstract Class Can contain Abstract Methods and Non-
Abstract Methods.
2. When a Non-Abstract Class is Inherited from an Abstract
Class, the Non-Abstract Class should provide all the
implementations for the inherited Abstract Method.
Interface:
1. Interface is nothing but Pure Abstract Class ie
Interface can contain only the function declaration.
2. All the members of the interface are Public by Default
and you cannot provide any access modifiers.
3. When a class is inherited from the interface, the
inherited class should provide actual implementations for
the inherited members.
Is This Answer Correct ? | 80 Yes | 18 No |
Answer / nasir munda
In abstract class public,private and protected method can used.
In Interface only public method can used.
Is This Answer Correct ? | 46 Yes | 7 No |
Answer / nasir munda
Abstract Class may contain constructor but interface does
not contain constructor.
Is This Answer Correct ? | 33 Yes | 8 No |
Answer / nitin kumar tomar
In interface All methods are abstract but in Abstract Class
some methods could be concrete.
There is no Methods Implimentation is allowed inside
interface and also No accessibility modifiers are not
allowed in interface.
Is This Answer Correct ? | 31 Yes | 11 No |
Answer / jitendra yadav
Abstract Class may contain constructor but interface does
not contain constructor.
Is This Answer Correct ? | 25 Yes | 8 No |
Answer / vanam santhosh
1.All the methods declared in interface are abstact whare
as Abstract must have atleast one abstact and others may
Concrete methods.
2.In abstact class Keyword is abstract must be used for the
methods.In Interface need not use the Keywords.
3.Abstact class must have subclass. where ads in Interfcs
need not have subclass.
4.In Abstarct class can extend only one class.where as in
Interface we can extend more than One Interface
Is This Answer Correct ? | 28 Yes | 16 No |
Answer / munwar
Interface and abstract class are just same,but both have
their own usability and advantages..
Difference b/w both.
1). Interface is highlevel abstract(means there is no
single implementation), but in abstract class there can be
implementation.
2)Interface does not allow accessfiers like
public,private.. but abstract class allow these accessifiers
3) Interface does not supports contant values but abstract
calss supports constatnt values..
4) Interface supports multiple inheritance but class does
not support multiple inheritance..
5).interface can not implement abstract class but abstract
calss can impelment interface...
Is This Answer Correct ? | 12 Yes | 0 No |
Answer / sanjay
In the abstract class we can define the member function
but in interface we can not define only declare the
function.
Is This Answer Correct ? | 11 Yes | 1 No |
Answer / saurabh
you can define variables in abstract class but this is not
allowed in interfaces.
Is This Answer Correct ? | 20 Yes | 11 No |
Why do we need constructor?
How to generate strong name key file or which command is used to generated strong name key file?
What is datetime parse in c#?
What is boolean method?
What is difference between assembly and dll?
c# code for how to merge two sorted arrays Input : A = 2,5,8,4 B = 3,9,10,5 Output : 2,3,4,5,5,8,9,10
What are properties and indexer?
What is ac callback?
What is strong name in c# and how can we use it?
Can we create instance for Abstract class?
28 Answers HCL, Satyam, SoftSol, Wipro,
How many types of constructors are there in c#?
What is lock statement in C#?