Features | Interface | Abstract Class |
Inheritance | A class may inherit several interfaces. | A class may inherit only one abstract class. |
Code | An interface contains only signature but no code | An abstract class can contain complete, default code and/or just signature that have to be overridden. |
Access Modifiers | An interface cannot have access modifiers | An abstract class can contain access modifiers |
Defines | Interfaces are used to define the peripheral abilities of a class | Abstract class defines the core identity of a class and there it is used for objects of the same type. |
Homogeneity | If various implementations only share method signatures then it is better to use Interfaces. | If various implementations are of the same kind and use common behaviour or status then abstract class is better to use. |
Fields | No fields can be defined | Fields can be defined |
Difference between Interface and Abstract Class
Compare Interface with Abstract Class
Subscribe to:
Post Comments (Atom)
Popular Posts
-
Cache Callback provides an ability where by some actions can be performed when that item is removed from cache CacheItemRemovedCallback ex...
-
XML DOM loads the entire xml document into memory whereas Simple API for XML ( SAX ) does not load entire xml document into memory XML DOM ...
-
Different types of diagrams in UML : UseCase diagram Class diagram Object diagram State diagram Sequence diagram Collaboration diagram...
-
Virtual-Override and New Class Child inherits from Class Parent and has mehtod ShowVirtualOverride() and ShowNew() methods. Please see th...
-
Question : Name few C# 3.0 enhancements ? Answer : The C# 3.0 language enhancements are as follows: Implicitly typed local variables I...
-
If locaction attribute is specified, must be one of: Any, Client, Downstream, None, Server or ServerAndClient.
1 comment:
Good help..
Post a Comment