Abstract classes have three characteristics:
First, cannot be instantiated.
Second, abstract methods in classes must be overridden in inherited subclasses.
Third, once a class has an abstract method, it must be defined as an abstract class.
In real-world development, common code is found that can be placed in an abstract class.For example, calculate the perimeter of a quadrilateral.
Rectangle, Rectangle, Square:
Source Code
class Rectangle { private double _A; public double A { get { return _A; } set { _A = value; } } private double _B; public double B { get { return _B; } set { _B = value; } } public Rectangle() { } public Rectangle(double a, double b) { this._A = a; this._B = b; } public double Perimeter() { return 2 * (_A + _B); } }