Swift中所有类的根类? [英] Root class of all classes in Swift?

查看:115
本文介绍了Swift中所有类的根类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Apple的开发人员文档说:

The Apple's developer documentation says:


NSObject是
大多数Objective-C类层次结构的根类,从中子类继承了运行时系统的基本接口。

NSObject is The root class of most Objective-C class hierarchies, from which subclasses inherit a basic interface to the runtime system.

在下面的示例中,我想知道Swift中所有类的根类是什么:

I wonder what is the root class of all classes in Swift in the example below:

class MyClass {
....
} 


推荐答案


Swift类不会从通用基类继承。您
定义的类而不指定超类将自动成为基础
类供您构建。

Swift classes do not inherit from a universal base class. Classes you define without specifying a superclass automatically become base classes for you to build upon.

https://developer.apple.com/library/content/documentation /Swift/Conceptual/Swift_Programming_Language/Inheritance.html

您在寻找什么吗? :)

Is that what you were looking for? :)

这篇关于Swift中所有类的根类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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