|
May 16, 2002 Defining Multiple Constructors Tips: May 2002
Yehuda Shiran, Ph.D.
|
|
The following class is used to construct
airplanes:
All airplanes instantiated using the Airplane class will be 767
because there's only one constructor that initializes the jet's model to 767. A class can have more than one constructor, as shown in the following listing:
You can create a 767 using the class's default constructor:
You can also create a 777 by calling the second constructor (with the parameter):
To learn more about JScript .NET, go to Column 108, JScript .NET, Part II: Major Features.
People who read this tip also read these tips: Look for similar tips by subject: |