HOWTO:相同的函数名称,不同的返回类型 [英] HOWTO: same function name, different return types

查看:80
本文介绍了HOWTO:相同的函数名称,不同的返回类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎么能这样做(我不是真的想这样做但是我做什么

想要相同的功能名称,但有不同的返回类型和

编译器一直说公共函数......它们的区别仅在于返回

类型)?


公共函数test()As Integer

返回1

结束功能


公共功能测试()单身

返回1

结束功能


谢谢

Peter

Hi, how can I do this (I don''t really want to do this but what I do
want the same function name but have different return types and the
compiler keeps saying "public function .... they differ only by return
types")?

Public Function test() As Integer
Return 1
End Function

Public Function test() As Single
Return 1
End Function

Thank you
Peter

推荐答案



公共功能测试(x为整数)为整数

返回1

结束功能


公共功能测试(x为单身)单身

返回1

结束功能


Peter写道:

Public Function test(x as Integer) As Integer
Return 1
End Function

Public Function test(x as Single) As Single
Return 1
End Function

Peter wrote:
我怎么能这样做(我不是真的想这样做,但我做的是
想要相同的函数名,但有不同的返回类型和
编译器保持小号aying公共功能....他们只有返回
类型不同?)公共功能测试()作为整数
返回1
结束功能

公共功能测试()单身
返回1
结束功能

谢谢
Peter
Hi, how can I do this (I don''t really want to do this but what I do
want the same function name but have different return types and the
compiler keeps saying "public function .... they differ only by return
types")?

Public Function test() As Integer
Return 1
End Function

Public Function test() As Single
Return 1
End Function

Thank you
Peter





公共函数测试(x为整数)为整数

返回1

结束函数


公共功能测试(x为单身)单身

返回1

结束功能


Peter写道:

Public Function test(x as Integer) As Integer
Return 1
End Function

Public Function test(x as Single) As Single
Return 1
End Function

Peter wrote:
我怎么能这样做(我真的不想这样做,但我做什么
想要相同的功能名称,但有不同的返回类型和
编译器一直说公共功能....它们只有返回
类型不同?

公共功能测试()作为整数
返回1
结束功能公共功能测试()单身
返回1
结束功能

谢谢
Peter
Hi, how can I do this (I don''t really want to do this but what I do
want the same function name but have different return types and the
compiler keeps saying "public function .... they differ only by return
types")?

Public Function test() As Integer
Return 1
End Function

Public Function test() As Single
Return 1
End Function

Thank you
Peter


谢谢,但我的功能不接受任何参数,即公共功能测试()

as .....


" yEaH rIgHt" <无****** @ haha​​.com>在消息中写道

news:10 ************* @ corp.supernews.com ...
Thanks but my functions don''t accept any arguments,ie public function test()
as ....


"yEaH rIgHt" <no******@haha.com> wrote in message
news:10*************@corp.supernews.com...


公共函数测试(x为整数)为整数
返回1
结束函数

公共函数测试(x为单)单身
返回1
彼得写道:

Public Function test(x as Integer) As Integer
Return 1
End Function

Public Function test(x as Single) As Single
Return 1
End Function

Peter wrote:
我怎么能这样做(我真的不想这样做,但我做了什么
想要相同的函数名称,但有不同的返回类型和
编译器一直说公共函数....它们只有返回
类型不同?

公共功能测试()作为整数
返回1
结束功能

公共功能测试()单身
返回1
结束功能

>谢谢
Peter
Hi, how can I do this (I don''t really want to do this but what I do
want the same function name but have different return types and the
compiler keeps saying "public function .... they differ only by return
types")?

Public Function test() As Integer
Return 1
End Function

Public Function test() As Single
Return 1
End Function

Thank you
Peter



这篇关于HOWTO:相同的函数名称,不同的返回类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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