Ian Branch 127 Posted November 1, 2019 (edited) Hi Team, As much as I don't want to I have to backport an App to D2007. It currently uses the following code to pass a variable around the App. unit ViewerData; interface type TViewerData = class class var // mssFileName: String; class constructor Create; // end; implementation Uses WindowsStore; class constructor TViewerData.Create; begin // mssFileName := ''; // end; end. It has been a long time since I toiled in D2007 but IIRC it doesn't support either WindowsStore or class constructor. Is the above code modifiable to D2007 compatability? Appreciate any guidance. Regards & TIA, Ian Edited November 1, 2019 by Ian Branch Correction to Subject. Share this post Link to post
dummzeuch 1505 Posted November 1, 2019 Make the class constructor a regular procedure, the class variable a variable inside the unit and call the procedure from initialization. Share this post Link to post
David Heffernan 2345 Posted November 2, 2019 Class vars are global variables inside a type's name's pace. Class constructors are called from unit initialization. Class destructor from unit finalization. Share this post Link to post
Stefan Glienke 2002 Posted November 2, 2019 If the code you posted is all the class constructor does it's pointless anyway as string variables don't have to be initialized to empty string. 1 Share this post Link to post
Ian Branch 127 Posted November 2, 2019 Hi Guys, Apologies for not responding sooner. Family issue. All sorted now thank you. As it was only one variable I just made it Global. Regards, Ian Share this post Link to post