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


Please Help Members By Posting Answers For Below Questions

how to create applications by using Visual Studio 2012?

722


How to prevent my .NET DLL to be decompiled?

772


What is private constructor? And it's use?

830


What actually happes when you add a something to arraylistcollection ?

665


Explain the use of virtual, sealed, override, and abstract.

752


Explain dma? : .NET Architecture

707


Do you know textbox and textview controls of .net mobile? : Microsoft dot net mobile

718


Define a virtual memory? : Dot net architecture

681


What is the importance of updatepanel control?

725


How resource files are used in .net?

755


What is .net mobile lists. : Microsoft dot net mobile

667


how to delete the record using data reader

2076


Explain the five stages in a dlx pipeline? : Dot net architecture

704


Explain pipelining? : Dot net architecture

755


Is dim fs as filestreamobject is a managed code? : Dot net architecture

696