Last active
April 19, 2017 09:07
-
-
Save freeonterminate/350924bfc542202c40a3cd4b7aa35ee6 to your computer and use it in GitHub Desktop.
Delphi's static method override
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
program StaticOverride; | |
type | |
TFoo = class | |
public | |
class procedure Bar; virtual; | |
end; | |
TBar = class(TFoo) | |
public | |
class procedure Bar; override; | |
end; | |
class procedure TFoo.Bar; | |
begin | |
Writeln(Self.ClassName); | |
end; | |
class procedure TBar.Bar; | |
begin | |
Writeln(Self.ClassName); | |
end; | |
begin | |
TFoo.Bar; | |
TBar.Bar; | |
Readln; | |
end. | |
出力結果: | |
TFoo | |
TBar |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment