什么是NSObject的实例 [英] What is an instance of an NSObject

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

问题描述

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

I am a newbie, and I am wondering what an instance of NSObject is. I am working on Xcode 3.2 and want to know what the instance is. I've heard this term often and am confused by it.

推荐答案

来自 Wikipedia on OOP中的对象

面向对象编程"中的对象;基本上是数据结构 结合相关的处理例程.例如,一个文件 是一个对象:数据的集合以及相关的读写 例行程序.对象被视为类的实例.共同点 说法是将文件称为类,而文件是 目的.一个类一次定义一个行为的属性,通常用于 多个实例化.在其他门徒中,这种区别也是 被称为属/种二分法.

Objects in "object-oriented programming" basically are data structures combined with the associated processing routines. For instance, a file is an object: a collection of data and the associated read and write routines. Objects are considered instantiations of classes. In common parlance one refers to a file as a class, while the file is the object. A class defines properties an behaviour once, usually for multiple instantiations. In other disciplies, this distincion is also known as gen genus/species dichotomy.

...

使用从创建每个对象的语言, 称为该类的实例.如果每个对象都有一个类型,则两个 具有相同类的对象将具有相同的数据类型.创建一个 类的实例有时称为实例化 课.

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

基本上是 NSObject 是Apple开发中的基础对象类型. NSObject定义了从其扩展的所有classes之间共享的所有事物:

Essentially the NSObject is the base object type in Apple development. The NSObject defines all things that are shared between all classes that extend from it:

NSObject是大多数Objective-C类层次结构的根类. 通过NSObject,对象继承了运行时的基本接口 系统和表现为Objective-C对象的能力.

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

如果您在对象实例化的定义方面苦苦挣扎,我建议花一些时间来学习编程和OOP风格编程的基础知识.理解此概念对于成功取得成功至关重要,如果您不学习基础知识而继续学习,则会进一步感到沮丧.

I would recommend taking some time to learn the basics of programming and OOP style programming if you are struggling with the definition of object instantiation. Understanding this concept is paramount to success down the road, and if you continue without learning the basics you will create further frustration.

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

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