Follow in Twitter & Facebook



Like in Facebook

Powered By Blogger Widgets

Free Download

FREE Tools



Wednesday, February 15, 2012

Difference between Abstract class and Interface

Here we will see what is the difference between abstract class and interface in C#.Net. You can also check my last article on Basic difference between Constant and readonly in C#.Net.

Abstract Class:
(1)- Abstract class is a class which contains both abstract method and non abstract method.

(2)- This is a special type of class that cannot be instanciated.

(3)- Abstract class have method defination and implementation .

(4)- It can contain acessmodifiers for function properties.

(5)- It doesnot support multiple inheritance.

(6)- Some methods are concrete.

(7)- It has constructer and destructor.

(8)- Only one abstract have to derived.

Interface:
(1)- An interface is not a class.It is an entity that is defined by the word Interface.

(2)- It has only signature or in otherwords just the defination of the methods without the body.

(3)- Interface has only signature.

(4)- All the methods are public,it doesn't have acess modifiers controls.

(5)- All the methods are abstract.

(6)- It doesn't have constructer and destructer fields.

(7)- It supports multiple inheritance in the object oriented language.

(8)- A class may inherits several interfaces.

Also you can check some Interview Questions.




0 on: "Difference between Abstract class and Interface"