Microsoft Dot Net Master

Microsoft Dot Net Master
Microsoft Dot Net Master

Sunday, February 17, 2013

Difference between Abstract and Interface

Abstract Class:
  1. Abstract class provides a set of rules to implement next class
  2. Rules will be provided through abstract methods
  3. Abstract method does not contain any definition
  4. While inheriting abstract class all abstract methods must be override
  5. If a class contains at least one abstract method then it must be declared as an “Abstract Class”
  6. Abstract classes cannot be instantiated (i.e. we cannot create objects), but a reference can be created
  7. Reference depends on child class object’s memory
  8. Abstract classes are also called as “Partial abstract classes”
  9. Partial abstract class may contain functions with body and functions without body
  10. If a class contains all functions without body then it is called as “Fully Abstract Class” (Interface)
Interface:
  1. If a class contains all abstract methods then that class is known as “Interface”
  2. Interfaces support like multiple inheritance
  3. In interface all methods r public abstract by default
  4. Interfaces r implementable
  5. Interfaces cannot be instantiated, but a reference can be created



No comments:

Post a Comment