什么是无效的AS3点 [英] what is the point of void in AS3

查看:103
本文介绍了什么是无效的AS3点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里

简单的问题,当空隙如下函数在AS3它在干什么?

 公共职能sayGoodbye():无效{跟踪(再见从MySubClass);}
 

解决方案

无效类型指示给你写的函数不会返回任何值,在编译器如果你指出除无效编译器期望返回牛逼其他类型T对方。

例如:

 函数foo(一:INT):INT {//这里编译器期望的地方
                          //在函数返回一个int
 返回;
}
 

Simple question here, when void follows a function in AS3 what is it doing?

public function sayGoodbye():void { trace("Goodbye from MySubClass");}

解决方案

void type indicates to the compiler that the function you have written will not return any value, in the other side if you indicate other type T than void the compiler expect that you return T.

Ex:

function foo(a:int):int { // here the compiler expect that somewhere
                          // in your function you return an int
 return a;
}

这篇关于什么是无效的AS3点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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