Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

EMPTY CLASS

Status
Not open for further replies.

andreateh

Programmer
Jul 19, 2003
83
SG
Can anyone show me the some example on implementing EMPTY class ? Is it possible to add an "EMPTY CLASS" to a form and act as a public variable ?
 
The empty class is nice way to consolitate all those public variables into a class/property design. It contains no properties or methods so it is very lightweight - compared to, let's say, a container class. You can do the same with a container, but it has overhead we don't need.

The empty class is nice easy to implement. Here is how you do it in a form.

1. add a new property to the form, I call mine data.
2. add the following code in the INIT event of the form.

THISFORM.data = CREATEOBJECT('empty')
addproperty(THISFORM.data,'customer')
addproperty(THISFORM.data,'id')
THISFORM.data.customer = "Sammy Sample"
THISFORM.data.customer = "123"
MESSAGEBOX(THISFORM.data.customer)
MESSAGEBOX(THISFORM.data.id)


You can also use this in your startup program. Therefore, all those public variables can be changed to properties of one public variable.

In my opinion though - the empty class needs the ability to programmatically add methods to it. Until that time comes - We stil need a container of some sort to hold the methods.



Jim Osieczonek
Delta Business Group, LLC
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top