Difference between abstract class and interface
Answers were Sorted based on User's Feedback
Answer / sumit gupta
the basic logical difference is you create abstract class when there is a relation between two classes that will inherit the abstract class and you create interface for the classes which are not related to each other but do have some common functionality.
below link describes it quite nicely.
http://devworkexperience.com/2011/09/interfaces-vs-abstract-classes/
Is This Answer Correct ? | 1 Yes | 1 No |
Answer / killer
An abstract class is a special kind of class It allow other
classes to inherit but cannot be instantiated. It Inherit
only one abstract class.
An interface is similar to Abstract class, it cannot use
override keyword in inheritance class. It inherits several
interfaces.
Is This Answer Correct ? | 1 Yes | 1 No |
Answer / arunachalam.m
To inherit the more than one interface class.... But in
abstract onle one abstract class can be inherit them....
Is This Answer Correct ? | 1 Yes | 1 No |
Answer / ravi anand pathak
1)-Abstract class required two key word for declaring
abstract class.
Interface required interface keyword for declaring the
interface.
2)-Within abstract class we can declare concrite and
abstract both type of method.
Interface support only abstract method.
3)-Variable declared within abstract class are normal.
All variables are emplicitly final,public static within
interface.
4)-We required abstract keyword to declared abstract
keyword.
All methods areemplicitlypublic and abstract.
5)-We use extends kyeword to inheriate any abstract class.
We use implements kyeword to use interfaces.
6)-Only one abstract class can extends at a time(single
inheritence).
We can use multipleinterface in a class at asame time(just
like multiple overriding).
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / penchalaramaiah
An Abstract class have an implementation but an interface should not any implementation and it contains only definition
and interface contains by default abstract methods but an abstract class contains subclassess
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / braham dutt
Abstract classes can have implementations for some of its
members (Methods), but the inteface class can't have
implementation for any of its members.
Abstract classes are faster than interfaces.
Interface comes in Inheritance chain while Abstract not.
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / ramana
abstract class is about to have defined and undefined methods.but in case of interfaces ,only method declarations are avaliable.abstract class can't support multiple inheritance but interfaces can support.
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / abi
In Abstract class we can do implementation for its methods
but in interface we can not do implemantations for any of
ti's methods
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / malar
In Abstract class:We cant create the instance for abstract
class..
In Interface:It allow to create the instance through
implementing classes...
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / ramani krunal
1. interface contains methods that must be abstract;
abstract class may contain concrete methods.
2. interface contains variables that must be static and
final; abstract class may contain non-final and final variables.
3. members in an interface are public by default,
abstract class may contain non-public members.
4. interface is used to "implements"; whereas abstract
class is used to "extends".
5. interface can be used to achieve multiple inheritance;
abstract class can be used as a single inheritance.
6. interface can "extends" another interface, abstract
class can "extends" another class and "implements" multiple
interfaces.
7. interface is absolutely abstract; abstract class can
be invoked if a main() exists.
8. interface is more flexible than abstract class because
one class can only "extends" one super class, but
"implements" multiple interfaces.
9. If given a choice, use interface instead of abstract
class.
Is This Answer Correct ? | 0 Yes | 1 No |
what are the things we generally declare in session_start , application_start ?
What actually happes when you add a something to arraylistcollection ?
So what exactly is the configuration file for then?
The maximum report processing jobs limit configured by your system administrator has been reached.How I can Solve this problem when i using crystal report to load from my application.
2. What type of code (server or client) is found in a Code-Behind class?
Explain about httpruntime.cach.get(); method?
What is cache coherency and how is it eliminated? : Dot net architecture
Explain Intermediate Language?
What is the main Difference Between .Net 2003 and .Net 2005.and also Asp1.1,Asp2.0 and Asp3.0
How to delete the duplicate records from table(having bulk records)?
Can you Explain <mobile:link> element .net mobile with example? : Microsoft dot net mobile
Explain the purpose of cache? How is it used? : Dot net architecture