Hello Bevan,

I'm not a CBuilder specialis but:

>   AnsiString msg = ((TWSocketClient*) Sender)->ReceiveStr();

This is a good typecast. It tells the compiler that Sender is of type
TWSocketClient, so compiler can do the exact address offset
calculations within the type. You still have to check if msg is > "".

>   TWSocketClient* Client = dynamic_cast<TWSocketClient*>(Sender);
>   AnsiString msg = Client->ReceiveStr();

The first line will execute, I think the second line will generate an
exception here. I'm not sure. Did you have it into an exception block ?

As far as I know the dynamic_cast is a kind of equivalent for 'is' or
'as' operators in Delphi and some other languages. It is not the same as
a type cast. I even think it will evaluate to false (null) because
Sender is of type TObject (yeah it "is" TWSocketClient, but compiler
dont know that).

Anyway dont trust my explanation because it is from the back of my head
:)

---
Rgds, Wilfried [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html
http://www.mestdagh.biz

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to