You welcome, the natural way to instantiate, use and release a class, is like this
Code:
type
tmyclass = class
public
constructor create;
end;
var
myclass: tmyclass;
begin
myclass:= tmyclass.create;
//
// some processing...
//
myclass.free;
end.
As you can see, I didn't declare a free destructor, it is implicitly inherited from tobject class. If you want to inherite some other class you must specify it when creating it, like this:
Code:
type
tmyclass = class(tcomponent)
public
constructor create;
end;
constructor and destructor are methods, just like any procedure, but have a fancy name and special purpouse. Inside them you must put your initialization and finalization code for the class. Of course you can inherite your own classes.
Hope this bring you some light. Happy codding!
Bookmarks