Chapter Contents |
Previous |
Next |
_NEO_ |
Category: | Object Oriented |
Syntax | |
Details | |
Example | |
See Also |
Syntax |
object-id=_NEO_ class-name(<init-arg<,new-arg-1<, . . . ,new-arg-n>>>); |
Type: Numeric or Object
Type: Character
Type: Character
Details |
The _NEO_ operator provides a faster and more direct way to create an object. It combines the actions of loading a class with LOADCLASS and initializing the object with the _new method, which invokes the object's _init method.
Example |
Create a frame and enter the following source code:
import sashelp.classes; init: dcl list AttrList RegionList; dcl checkbox_c c; AttrList = makelist(); RegionList = makelist(); startcol=10; startrow=10; rc = setniteml(AttrList, RegionList, '_region_'); rc = setnitemn(AttrList, -1, 'num'); rc = setnitemn(RegionList, startcol, 'ulx'); rc = setnitemn(RegionList, startrow, 'uly'); rc = setnitemc(RegionList, 'simple', 'border_style'); rc = setnitemn(RegionList, 5, 'border_width'); rc = setnitemc(RegionList, 'red', 'border_color'); c = _neo_ checkbox_c(attrlist); return;
Note that you cannot use the _NEW_ operator to do this, because _NEW_ passes its arguments to a constructor, whereas _NEO_ passes them to the _new method (which is what you want in this case). Even if you created a constructor for the checkbox, it would not work with the _NEW_ operator because the checkbox will be displayed before the constructor has a chance to run. Therefore, you must either resort to the old behavior using CALL SEND, or use the _NEO_ operator as shown above.
See Also |
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.