[fpc-pascal] Java equivalent of Pascal's class reference functionality
mailinglists at geldenhuys.co.uk
Thu Jun 9 01:17:46 CEST 2016
I know this is not a Java forum, but thought maybe somebody here with
Object Pascal and Java knowledge could help (seeing that Java-only
developers might not know what I'm talking about).
Does Java have an equivalent feature of a Object Pascal language's Class
I want to write Java code that does similar to my Object Pascal code
TVisClassRef = class of TVisitor ;
procedure ExecuteVisitor(const pData: TVisited; const pVisClass:
lVisitor := pVisClass.Create; // <<-- Important Part
This procedure takes care of the tedious business of creating the
visitor, calling iterate, then freeing the visitor when done. I can pass
in various class references as the second argument (all descendants of
TVisitor), and different class instances will be created and used as needed.
I would love to know how I could do this in Java.
More information about the fpc-pascal