What is an Abstract Class?
An abstract class is a
special class which cannot be instantiated but it needs to be
implemented in the sub class. The methods declared within the class
needs to be implemented (in the abstract class we only have the
declaration for the method) in the sub class using the "override"
keyword. The abstract class or method declared needs to have the keyword
"abstract".
- An abstract class can inherit from a class and one or more interfaces
- An abstract class can implement code with non-Abstract methods
- An Abstract class can have modifiers for methods, properties etc
- An Abstract class can have constants and fields
- An abstract class can implement a property
- An abstract class can have constructors or destructors
- An abstract class cannot be inherited from by structures
- An abstract class cannot support multiple inheritance
Comments
Post a Comment