On 2016-06-09 00:23, Ryan Gonzalez wrote:
> Not sure about your question exactly, but everything in Java is passed by
> reference

Not quite what I meant. :)  The Object Pascal feature is that my example
code - ExecuteVisitor() - doesn't know at compile time what instance
(any descendant of TVisitor) it is going to instantiate. That
information is only known at runtime.

Usage example:

  ExecuteVisitor(MyData, TShowNameVisitor);
or
  ExecuteVisitor(MyData, TShowEmailVisitor);
etc.

The ExecuteVisitor() will create an instance of the class I specify as
the second argument, and then use it as normal.

Regards,
  Graeme

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to