# Directives

DROP OBJECT | Delete Object

## Format

DROP OBJECT obj_id[,ERR=stmtref]
Where:

obj_id | Object identifier.
stmtref | Program line number or statement label to which to transfer control.

#### Note:
The DELETE OBJECT directive works the same as DROP OBJECT.

## Description

The DROP OBJECT directive is used to delete an object.

DROP OBJECT, DELETE OBJECT and the REF( ) function can all be used to delete an object. Only objects whose reference count is 1 can be deleted. Once an object is destroyed, its identifier may be reassigned to another object, although this is not recommended. All objects are destroyed when the application issues a START directive or if the END directive is entered at the Command mode.

REF(READ obj_id) returns the current reference count value. All calls to REF( ) return the current reference count (or 0 if deleted).

## See Also

Object Oriented Programming
DEF OBJECT Define Windows Object
Apostrophe Operator
Automation in PxPlus