如何避免超类方法被子类覆盖在objective-c中 [英] How to avoid superclass methods getting overridden by sub class in objective - c

查看:174
本文介绍了如何避免超类方法被子类覆盖在objective-c中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

类似于java:

final 类不能被子类化。这是为了安全性和效率的原因。因此,许多Java标准库类是final的,例如java.lang.System和java.lang.String。最终类中的所有方法都是隐式最终的。

A final class cannot be subclassed. This is done for reasons of security and efficiency. Accordingly, many of the Java standard library classes are final, for example java.lang.System and java.lang.String. All methods in a final class are implicitly final.

如何在objective-c中实现这种行为?

How can I achieve this behavior in objective-c?

推荐答案

你不能。效率不会进来。如果你是那些担心安全不使用objective-c。总是有办法解决你采取的任何措施。

You can't. Efficiency doesn't come into it. If you are that bothered about security don't use objective-c. There will always be a way to get around any measures you take.

这篇关于如何避免超类方法被子类覆盖在objective-c中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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