Mike Littlewood
asked on
How do I free up a self made class correctly?
Ive made a really small class object in a unit (no form)
Type TQICheck = class
Private
MessageString: String;
procedure CheckQValid;
procedure CheckIValid;
Public
constructor Create;
destructor Destroy; override;
function QMessageMe: String;
function IMessageMe: String;
End;
2 public functions to return me a message string based on calculations within the private procedures.
constructor TQICheck.Create;
begin
inherited Create;
MessageString := '';
end;
destructor TQICheck.Destroy;
begin
inherited Destroy;
end;
From another form when I click a button
procedure TForm_Main.TBB_QMessagesCl ick(Sender : TObject);
var
OutputString: string;
MyMessage: TQICheck;
begin
MyMessage.Create;
OutputString := MyMessage.QMessageMe;
MessageDlg(OutputString, mtInformation, [mbOK], 0);
end;
Everything seems ok to me but obivously Im missing a basic line or something if I want free/destroy it (through the application)
When I shutdown my App I get lots of access violations.
I havent put any other code into the program apart from this.
Can someone tell me what I need to handle this correctly
Type TQICheck = class
Private
MessageString: String;
procedure CheckQValid;
procedure CheckIValid;
Public
constructor Create;
destructor Destroy; override;
function QMessageMe: String;
function IMessageMe: String;
End;
2 public functions to return me a message string based on calculations within the private procedures.
constructor TQICheck.Create;
begin
inherited Create;
MessageString := '';
end;
destructor TQICheck.Destroy;
begin
inherited Destroy;
end;
From another form when I click a button
procedure TForm_Main.TBB_QMessagesCl
var
OutputString: string;
MyMessage: TQICheck;
begin
MyMessage.Create;
OutputString := MyMessage.QMessageMe;
MessageDlg(OutputString, mtInformation, [mbOK], 0);
end;
Everything seems ok to me but obivously Im missing a basic line or something if I want free/destroy it (through the application)
When I shutdown my App I get lots of access violations.
I havent put any other code into the program apart from this.
Can someone tell me what I need to handle this correctly
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
doh!
stupid mistake :/
thanks
stupid mistake :/
thanks
Don't think it's a little mistake..
Have a nice day,
Oktay
Have a nice day,
Oktay
Cheers,
Oktay Sancak