Method to Return Type of Class instance so that typeMethod can be invoked
See Parsys: 66529.
Provide a method on Class object that would return the type of the instance of the class. We would then be able to invoke the typeMethod for the Class represented by the instance of the class.
Allows for generic / dynamic code - could be used in "Factory" class
e.g
vars
lBicycle : Bicycle;
lClass : Class;
begin
write lBicycle@numberOfWheels; // returns 2
write lClass@numberOfWheels; // returns 0
lClass := Bicycle;
write lClass.castType.sendTypeMsg('numberOfWheels'); // returns 2
Alternatively provide a new method on Class that combines these "castType" (my name) and sendTypeMsg
sendType
HistoricalComments
Kevin Saul 15/04/2019 5:31:29 PM Does the work-around I added to the forum work for this? https://forums.jadeworld.com/viewtopic.php?f=11&t=2377
|