Click here to Skip to main content
14,040,817 members
Rate this:
Please Sign up or sign in to vote.
See more:
tell me the brief differance between abstract class and interface
Updated 27-Jan-10 22:06pm
bbirajdar 10-May-12 8:16am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Search Google/Bing with search string:
"difference between abstract class and interface"
Read the articles.

If you have a doubt, get back.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Check the Link for Details

Abstract Class versus Interface[^]
Rate this: bad
Please Sign up or sign in to vote.

Solution 4

Abstract classes can have implementations for some of its members (Methods), but the inteface class can't have implementation for any of its members.

Interfaces provide definitions of methods that must be implemented by a class. The purpose of interfaces is to allow you to generalise specific functionality regardless of implementation. You may have an IDatabase interface that defines Open()/Close(). The class that implements that interface may be connecting to a MySQL database or MS Access database. Irrespective of how it accomplishes this task, the goal is still the same.
Open database, close database.

Abstract classes are base classes that contain some abstract methods. They cannot be instantiated they are to be derived from. The purpose of an Abstract class is to allow you to define some generic functionality and sub-class to implement more specific functionality where appropriate.

So I suppose to summarize. You should use interfaces when the implementation of each class differs completely. Use abstract classes when you have some similar behaviour but need to implement parts differently.

Please have a look on following threads to get some needful:
This CP Article lists the differences between Interface and Abstract classes
Differences Between Interface and Abstract Classes[^]

Difference Between an Abstract Class and an Interface in C#[^]
Abstract class and Interface[^]
Difference between Abstract class and Interface in C# .Net[^]
8-Differences Between Interface and Abstract Class[^]

Hope it helps!
Rate this: bad
Please Sign up or sign in to vote.

Solution 5

1. A class can inherit only one abstract class at a time but one class can
implement more than one interface at same time.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Cookies | Terms of Service
Web01 | 2.8.190425.1 | Last Updated 10 May 2012
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100