On May 24, 2005, at 7:32 AM, GAmoore at aol dot com wrote:
Sub Append(theEmployee as EmployeeClass)
//you can append a nil EmployeeClass object, but do you want to?
me.pList.Append theEmployee
End Sub
Does your comment mean that you should have something like this:
if theEmployee <> nil then me.pList.Append theEmployee
Yes, but I would extend the function even further to not allow
duplicate copies of the same employee.
Sub Append(theEmployee as EmployeeClass)
If theEmployee Is Nil Then Return
Dim k As Integer
For k = 0 To UBound(pList)
If theEmployee Is pList(k) Then Return
Next
// If you get this far, add it to the list
pList.Append(theEmployee)
End Sub
The "Is" keyword means "is exactly" which will look at the Object
reference to see if the variables point to exactly the same object.
This will catch something like this:
employee01 = employee04
But it will not catch theEmployee instantances which have the same
values for the properties such as two objects both named Fred
Flitstone.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|