Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi function in Unterklasse - Erroneus Type (https://www.delphipraxis.net/122119-function-unterklasse-erroneus-type.html)

th_bone 9. Okt 2008 19:55


function in Unterklasse - Erroneus Type
 
Hi,

bisher hatte ich meine oft genutzten Proceduren/Funktionen in einer Klasse um einfach auf sie zuzugreifen.

Da es aber langsam unübersichtlich wird, wollte ich die Proceduren durch eine 2te Klasse schachteln um z.B.

aus myfunctions.nowUTC -> myfunctions.time.nowutc zu machen... was an sich auch beim programmieren funktioniert

- aber sobald ich auf eine funktion zugreife bekomme ich eine AccessViolation...

Danke

Ralf

Delphi-Quellcode:

unit myglobal;

interface

uses mytime;

type
  T = class
  public
    time: Tmytime;
  end;

implementation

end.

*********************

unit mytime;

interface

uses  Windows, Forms, SysUtils, jcldatetime, controls;

type
  TmyTime = class
  public
    function nowUTC: TDateTime;
  end;

implementation

function TmyTime.nowUTC: TDateTime;
var
  SystemTime: TSystemTime;
begin
  GetSystemTime(SystemTime);
  with SystemTime do
    Result := EncodeDate(wYear, wMonth, wDay) +
      EncodeTime(wHour, wMinute, wSecond, wMilliseconds);
end;

end.


Alle Zeitangaben in WEZ +1. Es ist jetzt 17:04 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz