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 |
Write a console application and implement the ternary operator to decide whether the age a user entered after being prompted is allowed to vote or not(given that only citizens between 18 and 120 years only inclusive can vote). Use exception handling for non-numerical input.
What is uint64_t?
What are the two kinds of properties?
Does c# do array bounds checking?
What is Garbage Collection in .Net?
what is c# command?
What is difference between out and ref in c#?
What does type safe mean in c#?
What does get set mean in c#?
Hi Everyone, the design of the form disappear during writing codes for dataset and data grid. The error show in "line of assigning dataset". I don't know what's happen. If anyone know , please share of technical help from someone. Thanks, Horace Trever
What is a string c#?
What is a class c#?