|
June 11, 2002 Extending Abstract Classes Tips: June 2002
Yehuda Shiran, Ph.D.
|
|
The following example demonstrates the use of abstract classes. The polygon class is a generic class for all types of polygons. We define it as an abstract class because we want the implementation to be provided by the rectangle and square classes that extend the polygon class:
Let's define now two variables, shape1 and shape2, of type polygon, and instantiate them with the new operator:
Let's print now their respective characteristics:
You should get the following statements:
To learn more about JScript .NET, go to Column 110, JScript .NET, Part IV: Inheritance.
People who read this tip also read these tips: Look for similar tips by subject: |