OK hier das Original:
Delphi-Quellcode:
unit AnLeUser;
interface
uses
SysUtils, Classes;
type
TUserData =
class(TObject)
private
FID : Integer;
FNick :
string;
FICQ :
string;
FAIM :
string;
FMSN :
string;
FYAHOO :
string;
FSKYPE :
string;
FEMAIL :
string;
FHP :
string;
FProfil :
string;
FBDay : TDateTime;
function GetBDay: TDateTime;
published
property ID : Integer
read FID
write FID;
property Nick :
string read FNick
write FNick;
property ICQ :
string read FICQ
write FICQ;
property AIM :
string read FAIM
write FAIM;
property MSN :
string read FMSN
write FMSN;
property YAHOO :
string read FYAHOO
write FYAHOO;
property SKYPE :
string read FSKYPE
write FSKYPE;
property EMAIL :
string read FEMAIL
write FEMAIL;
property HP :
string read FHP
write FHP;
property BirthDay : TDateTime
read GetBDay
write FBDay;
property Profil :
string read FProfil
write FProfil;
end;
TAnLeUser =
class(TComponent)
private
FUserData : TUserData;
function GetUserdata: TUserdata;
procedure SetUserData(
const Value: TUserdata);
{ Private-Deklarationen }
protected
{ Protected-Deklarationen }
public
{ Public-Deklarationen }
published
{ Published-Deklarationen }
constructor Create(AOwner : TComponent);
override;
property Userdata : TUserdata
read GetUserdata
write SetUserData;
property Name;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('
MaWe', [TAnLeUser]);
end;
{ TAnLeUser }
constructor TAnLeUser.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FUserData := TUserData.Create;
end;
function TUserData.GetBDay: TDateTime;
begin
if FBDay > 1
then
Result := Round(FBDay)
else Result:=StrToDateTime('
01.01.2000 00:00:00');
end;
function TAnLeUser.GetUserdata: TUserdata;
begin
if not Assigned(FUserData)
then
FUserData:=TUserData.Create;
Result:=FUserData
end;
procedure TAnLeUser.SetUserData(
const Value: TUserdata);
begin
if not (Value =
nil)
then
FUserData:=Value
else if (Value =
nil)
and(
not Assigned(FUserData))
then
FUserData:=TUserData.Create;
end;
end.
BTW @ Elvis:
Das geht au net:
Delphi-Quellcode:
procedure DeineKlasse.AfterConstruction;
begin
inherited;
fSomeValue := TSomeType.Create();
end;
gleicher Fehler(Und ich habe natürlich meine Klassennamen eingesetzt)