Sunday, 15 July 2012

Abstract Classes

ABSTRACT CLASSES : "You are so abstract ;-)"


1. Multiple Abstract classes cannot be inherited in an abstract.

( :-/ ) If you have an abstract class and you want multiple abstract classes to be inherited then it is not possible.


2. When inheriting the abstract class, you must follow the convension of inheriting the abstract class first before the interface, other wise it will show an error.

COMPILER ERROR - Base class 'YourAbstractClassName' must come before any interfaces
 



3. An abstract class can inherit multiple interfaces. Duh !!

4. When creating a class library which will be widely distributed or reused—especially to clients, use an abstract class in preference to an interface; because, it simplifies versioning.

5. An abstract method cannot be static. 


6. You can use sealed with the abstract methods. In other terms, An abstract class can be sealed.

 

No comments:

Post a Comment