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


Please Help Members By Posting Answers For Below Questions

What is cache coherency? : Dot net architecture

680


what is the method while we are using adapter and dataset ?

1558


What are the types of memory management? : Dot net architecture

668


What is .net mobile input validation. Explain with an example? : Microsoft dot net mobile

707


Explain hard disk and what is its purpose? : .NET Architecture

679


What is Video Streaming in .net??

749


Describe the Managed Execution Process in .NET?

699


What is the use of TPL DATAFLOW?

723


12. Types of polymorphisem[Run and Design Exp.]

1817


What is the use of web.config?

793


What is a service class?

747


Explain the types of memory management? : Dot net architecture

706


Explain .net mobile selectionlist control? : Microsoft dot net mobile

714


How to improve the cache performance? : .NET Architecture

730


What are different types that a variable can be defined and their scopes ?

819