Search This Blog

Tuesday, August 7, 2012

Difference between Interface and Abstract

Abstract 
Interface
1. Abstract is written where there are same common feature shared with all objects.
Class wholesaler()
{
Void text_books()
    {
       Common feature
    }
Void stationary();
}
Text book for 10th class use by retailer1 & retailer2
Stationary different by both retailers.

2. In Abstract class programmer provide SUB CLASS.

3. Create instance variable.

4. Contains Abstract method and concrete method.

5. All Abstract method should be implementing in Subclass.

6. Use Abstract keyword.                

1. Interface is written where all the feature are different implemented in different objects.

Textbook for 10th for retailer1
Textbook for 11th for retailer2

2.In Interface programmer provide implementation
Class.

3. Cannot create instance variable.

4. Contains Only Abstract method.

5. All in implementation class.

6. Use Interface Keyword.

7. Can not create object of interface.

No comments :