Appear in Online Interview to test your skills and be ready for job!
Twitter Twitter LinkedIn YouTube Google
Be Interview ready ! | Search
Submit content and win cash & prizes monthly.
Winners

Win Prizes

Announcements
Like us on Facebook
Sponsor
Top Forums Author
Thu, 24-Apr-2014 Authors
Bageshkumarbagi
10
Brierust
10
Chaithragm
10
All Time Authors
Jayakumars
3930
Karthikanbarasan
3455
Chvrsri
3140

Latest members | More ...


(Statistics delayed by 5 minutes)

Difference between interface and abstract class [Resolved]

Abhisekjani
Posted by Abhisekjani under C# on 3/22/2011 6:14:06 AM | Points: 10 | Views : 83204 | Status : [Member] | Replies : 6
what is the difference between abstract class and interface...........



Reply | Reply with Attachment

=> Scroll below for responses


Comments or Responses

Posted by: Mesh_2010 on: 3/22/2011 [Member] Starter | Points: 25


Hi,

difference between an interface and abstract class

In the interface all methods must be abstract; in the abstract class some methods can be concrete. In the interface no accessibility modifiers are allowed, which is ok in abstract classes.

Thanks
RameSH sinGH

Abhisekjani, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Geekgirl on: 10/25/2011 [Member] Starter | Points: 25

Abstract Class
1.It can contain Concrete methods(methods with implementation) So in other words, Abstract class can contain methods with both implemetaion
and without implementation
2.Multiple inheritance is not possible in case of abstract class
3.Access Specifiers are been Supported in abstract class


Interface
1.Does not contain any concrete methods
2.Multiple Inheritance is possible with interface
3.Access Specifiers are not supported in Interface




Abhisekjani, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Debal_saha@yahoo.com on: 1/31/2012 [Member] Starter | Points: 25

See the Difference between abstract class and Interface
http://silverlightpractice.blogspot.in/2012/01/what-is-difference-between-abstract.html

Abhisekjani, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bageshkumarbagi on: 10/5/2012 [Member] Starter | Points: 25

Interfaces and Abstract classes

*An Interface cannot implement methods.
*An abstract class can implement methods.

*An Interface can only inherit from another Interface.
*An abstract class can inherit from a class and one or more interfaces.

*An Interface cannot contain fields.
*An abstract class can contain fields.

*An Interface can contain property definitions.
*An abstract class can implement a property.

*An Interface cannot contain constructors or destructors.
*An abstract class can contain constructors or destructors.

*An Interface can be inherited from by structures.
*An abstract class cannot be inherited from by structures.

*An Interface can support multiple inheritance.
*An abstract class cannot support multiple inheritance.

Thanks,
Bagesh Kumar Singh
Mark as answer if you have been satisfied

Abhisekjani, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Satyapriyanayak on: 1/24/2013 [Member] Silver | Points: 25

Resolved

Abstract Class:-
1) An abstract method is created by specifying the abstract type modifier.
2) An abstract method contains no body.
3) An abstract method is not implemented by the base class.
4) An abstract method is automatically virtual.
5) A derived class must override it.
6) Abstract class can have modifiers for methods,properties etc.,
7) An abstract class can implement a property.
8) The abstract modifier cannot be applied to static methods.
9) Properties can also be abstract.
10) A class containing abstract methods must be declared as abstract with the abstract specifier.
11) There can be no objects of an abstract class.
12) If a derived class doesn't implement all of the abstract methods in the base class, then the derived class must also be specified as abstract.
13) An abstract class can inherit from a class and one or more interfaces.
14) An abstract class can implement code with non-Abstract methods.
15) Abstract class can have constant and fields.
16) An abstract class can have constructors or destructor's.
17) An abstract class cannot be inherited from by structures.
18) An abstract class cannot support multiple inheritance.
19) 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.

Interface:-
1) Interfaces cannot be instantiated directly.
2) Interfaces can contain events, method, indexer and properties.
3) An Interface can contain property definitions.
4) Interfaces contain no implementation of methods.
5) Classes and Structs can implement more than one interface.
6) An Interface can be inherited from by structures.
7) An interface itself can inherit from multiple interfaces (Interface can support multiple
inheritance).
8) An abstract class can implement a property.
9) 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.

If this post helps you mark it as answer
Thanks

Abhisekjani, if this helps please login to Mark As Answer. | Alert Moderator


Login to post response.

Comments / Responses
Select text & click toolbar to format. Formatting appears in viewmode only. HTML Tags are not allowed.
Bold Italic Underline Paragraph Title Code  Link 
 Wait ... Processing ..... please wait.

Found interesting? Add this to: