Delphi 这个语法是什么意思?
在这篇文章中,我试图弄清楚这段代码是如何工作的,我停在下面几行:Delphi 这个语法是什么意思?,delphi,Delphi,在这篇文章中,我试图弄清楚这段代码是如何工作的,我停在下面几行: type TOpenWeatherRequest = (ByCoords); 如何像这样定义类型TOpenWeatherRequest?括号的意思是什么?这是一个带有单个序数值的 这是一个具有单个序数值的 这意味着一种可枚举类型,可以在集合中使用常量,并对其执行一些逻辑操作 例如:在棋盘中,可以定义文字名称来表示棋子: type TChessPiece = (cpKing, cpBishop, cpKnight, cpR
type
TOpenWeatherRequest = (ByCoords);
如何像这样定义类型
TOpenWeatherRequest
?括号的意思是什么?这是一个带有单个序数值的 这是一个具有单个序数值的 这意味着一种可枚举类型,可以在集合中使用常量,并对其执行一些逻辑操作
例如:在棋盘中,可以定义文字名称来表示棋子:
type
TChessPiece = (cpKing, cpBishop, cpKnight, cpRoque, cpQueen, cpPawn);
var
Piece: TChessPiece;
Piece := cpBishop;
在课堂上看一个非常有趣的用法
type
TChessBoard = class
private
FPiece: TChessPiece;
public
constructor Create(Piece: TChessPiece);
procedure ShowValidMove;
end;
implementation
procedure TChessBoard.ShowValidMove;
begin
case FPiece of
cpKing: ShowMessage('Neighboard squares');
cpBishop: ShowMessage('Diagonal squares');
cpKnight: ShowMessage('L squares');
cpRoque: ShowMessage('Parallel squares');
cpQueen: ShowMessage('Roque AND Bishop squares');
cpPawn: ShowMessage('Goes to front, captures short diagonal');
end;
end;
看看我对这个问题的回答,我建议使用Enumerable type来求解逻辑矩阵,以隐藏一些特定的TabControl,这意味着一个Enumerable type,一个可以在集合中使用的常量,并使用它执行一些逻辑操作 例如:在棋盘中,可以定义文字名称来表示棋子:
type
TChessPiece = (cpKing, cpBishop, cpKnight, cpRoque, cpQueen, cpPawn);
var
Piece: TChessPiece;
Piece := cpBishop;
在课堂上看一个非常有趣的用法
type
TChessBoard = class
private
FPiece: TChessPiece;
public
constructor Create(Piece: TChessPiece);
procedure ShowValidMove;
end;
implementation
procedure TChessBoard.ShowValidMove;
begin
case FPiece of
cpKing: ShowMessage('Neighboard squares');
cpBishop: ShowMessage('Diagonal squares');
cpKnight: ShowMessage('L squares');
cpRoque: ShowMessage('Parallel squares');
cpQueen: ShowMessage('Roque AND Bishop squares');
cpPawn: ShowMessage('Goes to front, captures short diagonal');
end;
end;
看看我对这个问题的回答,我建议使用可枚举类型来求解逻辑矩阵,以隐藏一些特定的TabControls我在您提供的链接中没有看到这些代码,以便了解问题的上下文。无论如何,你都不应该依赖外部链接。请把我们需要了解的一切都写在问题本身中。@Jerry是的,它在回购协议中。您肯定认识枚举类型。@David所以我们鼓励用户发布非站点资源,迫使我们下载完整的存储库?这是什么时候改变的?不,我不认识它,因为它只有一个值,没有前缀。@Jerry不,我们没有。这个问题没有任何非现场链接,我在你提供的链接中没有看到代码,我不知道你问题的背景。无论如何,你都不应该依赖外部链接。请把我们需要了解的一切都写在问题本身中。@Jerry是的,它在回购协议中。您肯定认识枚举类型。@David所以我们鼓励用户发布非站点资源,迫使我们下载完整的存储库?这是什么时候改变的?不,我不认识它,因为它只有一个值,没有前缀。@Jerry不,我们没有。这个问题没有任何非现场链接。