May 17, 2002 - Exposing Class Properties | WebReference

May 17, 2002 - Exposing Class Properties

Yehuda Shiran May 17, 2002
Exposing Class Properties
Tips: May 2002

Yehuda Shiran, Ph.D.
Doc JavaScript

The following class constructs airplanes:

  class Airplane {
    var model: int;
  
    function Airplane() {
      model = 767;
    }
  } 
A class includes properties and functions. They are the members of the class. You can expose a class's property simply by creating a member variable as above, and allowing other code to directly manipulate it:

  class Airplane {
    var model: int;
  
    function Airplane() {
      model = 767;
    }
  } 
  var fifthJet : Airplane;
  fifthJet = new Airplane();
  fifthJet.model = 747;
To learn more about JScript .NET, go to Column 108, JScript .NET, Part II: Major Features.