抽象声明中没有参数名称? [英] No argument names in abstract declaration?

查看:94
本文介绍了抽象声明中没有参数名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是F#中抽象成员的典型声明:

This is the typical declaration of an abstract member in F#:

abstract member createEmployee : string -> string -> Employee

您可以定义参数类型,但不能定义其名称。如果没有名称,在实现接口时如何分辨每个参数是什么?换句话说,您如何知道该接口是否希望实现为1-或2-?

You define the argument types but not their names. Without names, how do you tell what each parameter is when you implement the interface? In other words, how do you know if the interface expects to be implemented as 1- or 2-?

1-   member this.createEmployee firstName lastName = ...
2-   member this.createEmployee lastName firstName = ...

我是从错误的角度看问题的(习惯于C#)吗?

Am I looking the problem from a wrong perspective (being used to C#)?

推荐答案

那是什么:

abstract member createEmployee : firstName:string -> lastName:string -> Employee

这篇关于抽象声明中没有参数名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆