Thom,
Thank you for this. It is exactly what I was looking for. And also
thank you to Jim who got me on the right track.
Jeff Edwards
On 04/05/2006, at 10:36 AM, Thom McGrath wrote:
Jim answered your question. You need to use typecasting. The
compiler is expecting any subclass of TCPSocket. Your array could
contain any number of different subclasses. So it can only return
the most common class: the TCPSocket. You need to manually tell the
compiler that variable x contains a reference to an object of your
subclass.
dim sockets(),s as myTCPSocket.
dim i as integer
sockets = myServerSocket.ActiveConnections
for i = 0 to ubound(sockets)
if sockets(i) isa myTCPSocket then
s = myTCPSocket(sockets(i)) // this is called typecasting, very
important feature
s.customProperty = true
end
next
It's a good idea to check the class of the object before attempting
to typecast it. That's why I added the if block. It's not
mandatory, but a good practice to get into.
_______________________________________________
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>