CApphot:new


The new method creates an instance of the CApphot class. This method returns to the caller a reference to the object it creates. The calling code must assign this reference to a name (see below). If the object cannot be created, nil is returned.

Note: This method's name uses all lower case to present it as the analog of the C++ new operator. Generally, the names of class methods begin with an uppercase letter but new and delete are different.

Syntax

A = CApphot:new()

A = CApphot:new( CApphot2 )

where

 

    The first form, with no arguments, creates a new CApphot A with all properties set to default values.

    CApphot2 is an existing CApphot object. The second form creates a new CApphot object initialized to the properties of CApphot2.

Example

The following example shows the default constructor and destructor pair:

 

A = CApphot:new()

-- create a new instance of A of the CApphot class.

  --

-- other uses of the class go here, between new and delete.

A:delete()

-- deletes the object and its associated memory.

The next example shows the use of the 2 constructors:

 

A = CApphot:new(A1)

-- copy constructor, duplicates the data in A1

B = CApphot:new()

-- default constructor

B.nRadius1 = 4.5

-- Set the value of nRadius1

B.nRadius2 = 12

-- Set the value of nRadius2

B.nRadius3 = 16

-- Set the value of nRadius3

bSuccess = B:Measure(I,x,y)

-- Measure object at (x,y) in CImage I

Printf("Mag = %lg", B.nMag )

-- result: Mag = 15.256

Related Topics

Copy

delete

CApphot class