Thursday, January 20, 2011

Abstract class (c#)

When you gone a interview, most of interviewer interest to ask different between abstract and class.

The answer is simple.

The abstract modifier can be used with classes, methods, properties, indexers, and events.
* An abstract class cannot be instantiated.
* An abstract class may contain abstract methods and accessors.
* It is not possible to modify an abstract class with the sealed modifier, which means that the class cannot be inherited.
* A non-abstract class derived from an abstract class must include actual implementations of all inherited abstract methods and accessors.

No comments: