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 |
Explain a .net mobile example with details? : Microsoft dot net mobile
Explain COM with example?
Explain about the base class library provided by microsoft.net?
What is .net mobile images control. Explain with an example? : Microsoft dot net mobile
What does the term "green architecture" mean? : .NET Architecture
So what exactly is the configuration file for then?
Define an interrupt? : Dot net architecture
What is .net viewstate?
What does this do? Gacutil /l | find /i "corillian"
what are the fundamental and common properties of .net controls?
Difference between type constructor and instance constructor?
5. Wcf- Session Managment