Il 03/05/23 16:44, Steve Litt via fpc-pascal ha scritto:
José Mejuto via fpc-pascal said on Wed, 3 May 2023 11:35:50 +0200

Hello,

Attached is a dirty implementation of "touch" for junctions
==========================================================
TTouchJunction = class(TCustomApplication)
   protected
     procedure DoRun; override;
     function DateTimeToFileTime(DateTime: TDateTime): TFileTime;
   public
     constructor Create(TheOwner: TComponent); override;
     destructor Destroy; override;
     procedure WriteHelp; virtual;
   end;
==========================================================

I'm an old Turbo Pascal (mainly 3.x, a little 5.5) guy and don't
remember or never saw override and virtual. What do they do?

SteveT

 *

   Override: When you're dealing with objects, you have the
   inheritance, that is you may derive a new class (the template of an
   object) from an existing class and the newly created class inherits
   all the methods and properties of the parent class. In this case
   TTouchJunction is declared as a descendant of TCustomApplication,
   therefore it inherits all the methods and properties. If you need
   that your object does something different from the methods of its
   parent, but keep the same name, you must declare that your
   declaration overrides the ancestors one. If in the body of your new
   method if you want to execute also the ancestor method you may call
   it with the keyword "inherited".

 *

   Virtual: means that this method can be overridden by a descendant
   class. The same does the keyword Dynamic.  The difference has to do
   with the way the code is allocated in memory. Virtual is optimized
   for speed, Dynamic for memory.

Hope that it helps.

Giuliano

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

Reply via email to