Difference between abstract class and interface

Answer Posted / ratikant patra

1.*Abstract class may contain abstract methods,constru-
-ctors,concrete methods,fields....
*interface only contain signature of methods and
fields.

2. *All access specifiers are allowed to class members in
abstract class.By default scope is package or public
depends on programming.
*But data fields and method signatures bydefault final
and public.

****WE KNOW JVM TREATS FINAL METHODS AS INLINE. SO, DYNAMIC-
POLYMORPHISM THROUGH INTERFACE IS FASTER THAN OTHER.
************

3.Abstract class always a super class,only can beextended.
But interface only can be implimented.

4.Code reusability possible by extending abstract classes
*But code reusability not possible using interface.

5.Abstract class is used when programmer need to maintain
property of super class in sub classes i.e. programmer
may override complete methods(but bound to redefine
abstract methods.unless sub class becomes abstract).
*In case of classes implimenting interface must define
all the methods.

6.At a time we can extend only abstract class.
*But we can impliment many interfaces to a class.

RATIKANT PATRA,KIST,BBSR

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How will you do windows authentication and what is the namespace?

542


What happens to the winfx technologies?

577


How to implement the display in the class printdoc (how to resolve the naming conflict) a: no naming conflicts

617


Explain different pipelining hazards and how are they eliminated? : .NET Architecture

509


Explain the difference between l1 and l2 cache? : .NET Architecture

557






8. Oop-Why and were we use Interfacse and Abstract class.

1591


What is an asssembly qualified name? Is it a filename? How is it different?

510


Define dma? : Dot net architecture

550


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

1648


server.transfer limitation ?

1796


How cache coherency is eliminated? : Dot net architecture

516


What is msil, and why should my developers need an appreciation of it if at all?

537


What is the difference between l1 and l2 cache? : Dot net architecture

525


How to prevent my .NET DLL to be decompiled?

574


Describe the Managed Execution Process in .NET?

541