有没有办法覆盖动作脚本运算符,特别是我想覆盖等于运算符 [英] Is there a way to override action scripts operators, in particular I would like to override the equals operator

查看:23
本文介绍了有没有办法覆盖动作脚本运算符,特别是我想覆盖等于运算符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以覆盖 equals() 运算符(即,对于可能由 2 个或更多字段匹配确定相等性的客户类).

Is it possible to override the equals() operator (ie. for customer classes where equality may be determined by 2 or more fields matching).

推荐答案

如果您的意思是重载=="作为 equals() 的同义词,那么您不能,因为 ActionScript 不提供运算符重载.只需为您的类编写一个 equals() 方法并使用它...

if you mean overloading "==" as a synonym for equals() then you can't, as ActionScript doesn't offer operator overloading. Just write an equals() method for your class and use that...

这篇关于有没有办法覆盖动作脚本运算符,特别是我想覆盖等于运算符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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