SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 84 | Next

Robin Pars, Laurence Moroney, and John Grieb

"Foundations of ASP.NET AJAX"

SUV.prototype =
{
get_DriveType: function()
{
return this._DriveType;
},
dispose: function()
{
alert("Disposing instance of class SUV");
}
}
AJAXBook.SUV.registerClass("AJAXBook.SUV", AJAXBook.Car);
The earlier code implemented an AJAXBook.Car class that had a constructor that
received three parameters to initialize the _Make, _Model, and _Year members on the Car
object. This code now implements the SUV class. The SUV constructor takes the same
parameters as the Car constructor, plus an additional parameter (strDriveType) that specifies
the type of 4WD the vehicle will use.
The first line of the SUV constructor passes the make, model, and year up to the base
class, so they can be initialized in the base class, thereby avoiding the need to duplicate
them in the initialization code in the AJAXBook.SUV class. The SUV constructor then implements
and initializes the single distinct property of the SUV class: _DriveType. The
prototype of the class contains two methods: the first allows you to define the DriveType
property, and the second, the Dispose method, just displays an alert that the memory of
the class instance is being reclaimed.


Pages:
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96