Newsgroups : Borland : borland.public.delphi.internet.winsock : 2007 Dec : Re: idfTP and Socks problem

www.cryer.info
Managed Newsgroup Archive

Re: idfTP and Socks problem

Subject:Re: idfTP and Socks problem
Posted by:"Remy Lebeau (TeamB)" (no.spam@no.spam.com)
Date:Wed, 12 Dec 2007 17:08:23

"UlfH" <ulf_honkanen@nospam.umu.se> wrote in message
news:47607ced$1@newsgroups.borland.com...

> No. It makes an instance of TIdCustomTransparentProxyClass

TIdCustomTransparentProxyClass is a meta type, not an actual class type:

    TIdCustomTransparentProxyClass = class of TIdCustomTransparentProxy;

When this line is called:

    FTransparentProxy := LClass.Create(nil);

LClass is pointing at the TIdSocksInfo class type, and thus will create a
TIdSocksInfo instance.  Since FTransparentProxy is declared as a
TIdCustomTransparent object, it will then call GetEnabled() via
polymorphism, allowing TIdSocksInfo to override GetEnabled().

That is the basis of Delphi meta class programming, which is what allows VCL
packages to work in the first place - being able to register and instantiate
classes without the code having to know what they actually are.
SetTransparentProxy() is utilizing a portion of that functionality -
instantiating object instances from meta data - to allow the source
TIdSocksInfo object to clone itself when it has no Owner assigned.


Gambit

Replies:

none

In response to:

www.cryer.info
Managed Newsgroup Archive