Difference between abstract class and interface
Answer Posted / vikash kumar
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 ? | 2 Yes | 0 No |
Post New Answer View All Answers
readonly syntax ?
Is .net easier than java?
Explain cache? : .NET Architecture
what are login controls?
Tell me .net mobile emulators? : Microsoft dot net mobile
any one can explain about projectarchitecture and project approach briefly
if there are two application 1 and 2 having a variable x in both app if client1 changes value of x in 1 app client 2 want reads the value of x from 2 app what resultant value will he get
What is Opf3
What is a virtual memory? : .NET Architecture
What is a clickonce application?
How to upload in video,mp4,in .net 4.5 ..?
What are the different pipelining hazards? : Dot net architecture
What is cache coherency? : Dot net architecture
Explain different pipelining hazards and how are they eliminated? : .NET Architecture
Explain about validation?