gpt4 book ai didi

instance - 什么是 NSObject 的实例

转载 作者:行者123 更新时间:2023-12-04 03:06:40 24 4
gpt4 key购买 nike

我是新手,我想知道 NSObject 的实例是什么。我正在使用 Xcode 3.2,想知道实例是什么。我经常听到这个词,但对它感到困惑。

最佳答案

来自 Wikipedia on Objects in OOP

Objects in "object-oriented programming" basically are data structurescombined with the associated processing routines. For instance, a fileis an object: a collection of data and the associated read and writeroutines. Objects are considered instantiations of classes. In commonparlance one refers to a file as a class, while the file is theobject. A class defines properties an behaviour once, usually formultiple instantiations. In other disciplies, this distincion is alsoknown as gen genus/species dichotomy.

...

In a language where each object is created from a class, an object iscalled an instance of that class. If each object has a type, twoobjects with the same class would have the same data type. Creating aninstance of a class is sometimes referred to as instantiating theclass.

本质上是 NSObject是 Apple 开发中的基本对象类型。 NSObject 定义了从它扩展的所有 classes 之间共享的所有东西:

NSObject is the root class of most Objective-C class hierarchies.Through NSObject, objects inherit a basic interface to the runtimesystem and the ability to behave as Objective-C objects.

如果您正在为对象实例化的定义而苦恼,我建议您花一些时间学习编程和 OOP 风格编程的基础知识。理解这个概念对于今后的成功至关重要,如果您继续不学习基础知识,您将进一步感到沮丧。

关于instance - 什么是 NSObject 的实例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10438986/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com