HBObject() > Methods for object creation and initialization xHarbour Developers Network  

oHBObject:new()

Creates a new instance of a class.

Syntax

:new( [<params,...>] ) --> oInstance

Arguments

<params,...>
Optionally, a comma separated list of parameters can be passed to :new(). They are forwarded in the same sequence to the :init() method of the class. The :init() method must be declared in a user-defined class for accessing the passed parameters when an object is initialized in the :init() method.

Return

The method returns a new instance of the class.

Description

Method :new() is the only method that creates instances of a class. The method is special since it can only be used with the class function of a class, not with an object. This is the basic syntax pattern for creating a new object:

   oNewObject := ClassFunction():new()

Note:  it is not recommended to re-define the :new() method in a user-defined class.


Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe