>
> Yup!
>
> Of course, there are pros and cons to all this. Our once simple,
> straightforward language is not littered with "convenience" features that
> are not necessary at all. For example, what is the big advantage of class
> methods over simple functions and procedures?
>
Class methods can be virtual and have access to other (perhpas protected)
class members of the class.
type
TA = class
public
class procedure Hello; virtual;
end;
TB = class(TA)
public
class procedure Hello; override;
end;
TAClass = class of TA;
{ TA }
class procedure TA.Hello;
begin
ShowMessage('Hello this is ' + ClassName); // see I can access ClassName
end;
{ TB }
class procedure TB.Hello;
begin
inherited Hello;
ShowMessage('A different message here');
end;
{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
var
SomeClass: TAClass;
begin
SomeClass := TB;
SomeClass.Hello;
end;
_______________________________________________
fpc-pascal maillist - [email protected]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal