Is there any plans to implement public procedures/function of a class that can be used without been necessary to create the class?
Mailing lists / fpc-pascal / 2012-02
(no subject)
9 messages · 8 people · –
- EEverton Vieira 2
- FFelipe Monteiro de Carvalho 1
- HHoward Page-Clark 1
- JJonas Maebe 1
- LLukasz Sokol 1
- MMattias Gaertner 1
- +2 more
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
Everton Vieira wroteIs there any plans to implement public procedures/function of a class that can be used without been necessary to create the class?
Do you know class procedures/functions?
=== example begin ===
type
TTestClass = class
class procedure Foo;
class function Bar: LongInt;
end;
class procedure TTestClass.Foo;
begin
end;
class function TTestClass.Bar: LongInt;
begin
end;
var
x: LongInt;
begin
TTestClass.Foo;
x := TTestClass.Bar;
end.=== example end ===
Regards,
Sven
Is there any plans to implement public procedures/function of a class that can be used…
Everton Vieira wrote 5 lines
does
class procedure foo(bar: TSomething);not work ?
L.
Is there any plans to implement public procedures/function of a class that can be used…
Everton Vieira wroteIs there any plans to implement public procedures/function of a class that can be used without been necessary to create the class?
I presume you know about class methods such as TObject's
class function ClassName : shortstring;that you can use like this
procedure TForm1.Button1Click(Sender: TObject);
begin
ShowMessageFmt('Class name of TEdit is %s', [TEdit.ClassName]);
end;without needing to instantiate a TEdit instance?
Is there any plans to implement public procedures/function of a class that can be used…
Everton Vieira hat am 23. Februar 2012 um 17:17
geschrieben:
Show quoted text 10 lines
Is there any plans to implement public procedures/function of a class that can be used…
I think that you just described class methods:
http://www.freepascal.org/docs-html/ref/refsu27.html
Is there any plans to implement public procedures/function of a class that can be used…
Everton Vieira wroteIs there any plans to implement public procedures/function of a class that can be used without been necessary to create the class?
Those already exist. They are called "class methods". See http://www.freepascal.org/docs-html/ref/refsu27.html
Jonas
Is there any plans to implement public procedures/function of a class that can be used…
Everton Vieira wroteIs there any plans to implement public procedures/function of a class that can be used without been necessary to create the class?
This exists: class functions.
Given the declaration
TMYClass = Class
Class function doGLobal (Arg : ArgType) : Resulttype;
end;Then
TMyClass.doGlobal(a)
Is Valid.
Michael.
Exactly that i was meant, thank you people.
2012/2/23 Michael Van Canneyt
