实例和对象有什么区别? [英] What is the difference between an Instance and an Object?

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

问题描述

实例和对象有什么区别?有没有区别?

What is the difference between an Instance and an Object? Is there a difference or not?

推荐答案

实例和对象来自 面向对象编程.

对于一些编程语言,如 Java、C++ 和 Smalltalk,描述和理解代码很重要.在结构化编程中使用的其他语言中,这个概念不存在.

For some programming languages like Java, C++, and Smalltalk, it is important to describe and understand code. In other languages that used in Structured Programming, this concept doesn't exist.

这是结构化编程的观点.没有真正的显着差异应该消耗你太多的时间.可能有一些花哨的语言,有些人可能会占用很多空间来写,但归根结底,就编码员、开发人员、程序员、架构师而言,一个实例类和对象的含义相同,通常可以互换使用.在我的职业生涯中,我从未遇到过任何人会挑剔并花半小时试图指出差异,因为真的没有.时间可以更好地用于其他开发工作.

This is a view from Structural Programming. There's no real significant difference that should consume too much of your time. There might be some fancy language that some people might take up a lot of spaces to write about, but at the end of the day, as far as a coder, developer, programmer, architect, is concerned, an instance of a class and an object mean the same thing and can often be used interchangeably. I have never met anyone in my career that would be picky and spend a half-hour trying to point out the differences because there's really none. Time can be better spent on other development efforts.

更新 关于 Swift,这是发明 Swift 的 Apple 更喜欢的:

UPDATE With regards to Swift, this is what Apple who invented Swift prefers :

类的实例传统上称为对象.然而,Swift 类和结构在功能上比在功能上更接近其他语言,本章的大部分内容描述的功能可以应用于类或结构类型的实例.因为其中,使用了更通用的术语实例.

An instance of a class is traditionally known as an object. However, Swift classes and structures are much closer in functionality than in other languages, and much of this chapter describes functionality that can apply to instances of either a class or a structure type. Because of this, the more general term instance is used.

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

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