Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Difference between abstract class and interface

Answer Posted / mohammad mousa fanasheh

Multiple inheritance:
interface :A class may inherit several interfaces.

Subtract: A class may inherit only one abstract class.


Default implementation:
An interface cannot provide any code, just the signature.

An abstract class can provide complete, default code and/or just the details that have to be overridden.

Access Modfiers:
An interface cannot have access modifiers for the subs, functions, properties etc everything is assumed as public

An abstract class can contain access modifiers for the subs, functions, properties

Core VS Peripheral:
Interfaces are used to define the peripheral abilities of a class. In other words both Human and Vehicle can inherit from a IMovable interface.

An abstract class defines the core identity of a class and there it is used for objects of the same type.



Speed:
Interface Requires more time to find the actual method in the corresponding classes.

abstract class Faster

Adding functionality (Versioning):
In interface .. If we add a new method to an Interface then we have to track down all the implementations of the interface and define implementation for the new method.

In abstract class ..If we add a new method to an abstract class then we have the option of providing default implementation and therefore all the existing code might work properly.

Fields and Constants:
No fields can be defined in interfaces
An abstract class can have fields and constrants defined

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the different pipelining hazards and how are they eliminated? : Dot net architecture

1088


Explain the race around condition? How can it be overcome? : Dot net architecture

1012


Explain difference between state server and sqlserver? : .NET Architecture

992


What is the cli? Is it the same as the clr?

1012


what is the difference between running an application with and without debugger?

2137


Explain write back and write through caches? : .NET Architecture

945


Explain the purpose of cache? How is it used? : Dot net architecture

1037


What are end points, contract, address and bindings?

967


Define an interrupt? : Dot net architecture

1023


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

993


What is the purpose of hard disk? : Dot net architecture

1011


Explain write back and write through caches? : Dot net architecture

1085


Explain what does the term "green architecture" mean? : Dot net architecture

1006


can u give me real example of how web.config overrides the machine.config file?

1839


Describe the advantages of writing a managed code application instead of unmanaged one. What is involved in certain piece of code being managed?

1070