Difference between abstract class and interface
Answer Posted / 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 |
Post New Answer View All Answers
What are the different pipelining hazards? : Dot net architecture
Difference between throw exception and rethrowing ?
Can you Explain
What is the difference between absolute expiration and sliding-time expiration?
What is a clickonce application?
How to implement the display in the class printdoc (how to resolve the naming conflict) a: no naming conflicts
question related to table havi colspan and row span
Define an interrupt? : Dot net architecture
What's the difference between an application and a program?
Explain dma? : Dot net architecture
What is difference between Desktop, Client Server & Web based applications?
What is difference between .net and visual studio?
What does this do? Gacutil /l | find /i "corillian"
How do I write to the application configuration file at runtime?
Are there any third party logging components available?