On Wed, Jan 13, 2010 at 19:13, David Emerson <[email protected]> wrote:
>
> d.2. wrt class methods, can they be virtual? (This strikes me as being
> closely related to d.1)
>
Definitely, yes! (and I believe that was available before class
vars/consts) I use this great feature for (de)serialization of
messages in my client/server communication:
TMessage = class
public
constructor Create; virtual;
class function GetCode: Word; virtual;
Code: Word;
...
end;
constructor TMessage.Create;
begin
Code := GetCode;
end;
So, when I want to create new message, I just call
TLoginMessage.Create or TChatMessage.Create or whatever (those classes
override GetCode, and everything works perfect).
_______________________________________________
fpc-pascal maillist - [email protected]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal