pascalabcnet/TestSuite/lambdas20.pas
Ivan Bondarev 4c2df22526 #2892
2023-11-03 17:24:20 +01:00

22 lines
777 B
ObjectPascal
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

type
// Обязательно внутри класса
t1 = class
// Не важно, статический ли метод
//
// Обязательно имя Equals
//
// Обязательно первый параметр - класс
// (из .dll или паскалевский - не важно)
//
// Обязательно p должен принимать параметр,
// чтобы лямбда ниже его авто-вычисляла
public static function Equals(o: Exception; p: byte->()) := true;
end;
begin
// Обязательно передать именно лямбду,
// а не существующую подпрограмму
assert(t1.Equals(nil, l->begin end));
end.