[Lazarus] Frog game. OO-izing SDL. Replace record with class then Lazarus can't find .create or .free for class
Alberto Narduzzi
albertonarduzzi at yahoo.com
Fri Jan 28 21:55:25 CET 2011
> I am modernising the SDL unit by replacing all of the records with
> classes. This should avoid warnings.
> and then
>
> var
> whatever1 : whatever;
> begin
> // new(whatever1);
> // becomes
> whatever1 := whatever.create;
> ...
> and Lazarus does not understand how to do a
>
> whatever1.whatever.create;
> nor a
> whatever1.free;
maybe because your classes don't descend from any other class that owns
a "create" or "free" methods...
If you use classes, out of the top of my head, I could say that an
instantiation, like
var C: MyRecordConvertedToClass;
...
C.X = 10;
C.Y = 20;
should be enough.
Otherwise, you had better define a base class, with constructor and
destructor, overriding them as needed in every derived class.
Anyone correct me if I am wrong in this statement...
Cheers, A.
More information about the Lazarus
mailing list