在委托的C#文档中,它说"委托是一种可用于封装命名或匿名方法的引用类型.委托类似于C++中的函数指针;但是,委托是类型安全且安全的 "
我的问题是,代表什么意思是" 安全 "?
在本文中,给出了以下代码行的示例:
x = layers.Dense(64, activation="relu", name="dense_1")(inputs)
Run Code Online (Sandbox Code Playgroud)
这似乎是一个函数调用,它首先传入 64,然后传入两个命名参数,然后传入input
.
这里发生了什么?是inputs
被传递给layers.Dense
还是别的什么?
我有以下基本代码
import 'package:flutter/material.dart';
//write the main method
void main() => runApp(const MyApp());
//write the MyApp class that extends the StatelessWidget class
class MyApp extends StatelessWidget {
//write the const ctor
const MyApp({super.key});
//write the build method
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'hello',
home: Scaffold(
appBar: AppBar(
title: const Text('hello'),
),
body: const Center(
child: Text('hello'),
),
));
}
}
Run Code Online (Sandbox Code Playgroud)
注意常量构造函数,
const MyApp({super.key});
Run Code Online (Sandbox Code Playgroud)
我认为卷曲提示 {} 用于可选的命名参数。
我在这里看到没有名字。
这是怎么回事?将 {super.key} 传入常量构造函数意味着什么?
.net ×1
c# ×1
constructor ×1
dart ×1
delegates ×1
flutter ×1
function ×1
python ×1
python-3.x ×1
security ×1