oops中对象和实例之间的区别? [英] Difference between object and instance in oops?

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

问题描述

任何人都可以告诉我oops中对象和实例之间的区别吗?我在采访中遇到的这个问题。



提前谢谢

Can anyone please tell me the difference between object and instance in oops? This question i faced during interview.

Thanks in advance

推荐答案

单词template,和blueprint非常好地描述了类,结构,表单,用户控件,组件,窗口或Program.cs文件的代码是什么。



对象的描述渲染成真实对象(实例化,创建)......存在在内存中......在.NET中的阶段:它被编译(翻译,构建)到MSIL中间代码中;该中间代码由JIT编译器编译,jitted代码由.NET运行时引擎执行。您告诉编译器要创建实例的对象已经为它们分配了内存,并且该内存用于保存对象内部结构的数据。



运行时所拥有的是对这些实例化对象的引用,您可以使用它们来访问公开的对象的内部数据和状态。



An实例化对象不是类,结构或其他任何内容的副本,就像房子不是一组蓝图的副本一样。
The words "template," and "blueprint" are very good descriptions of what the code for a Class, or Struct, or Form, or UserControl, or Component, or Window, or Program.cs file ... is.

Those descriptions of objects are rendered into "real" objects (instantiated, created) ... that "exist" in memory ... in stages in .NET: it is compiled (translated, built) into MSIL intermediate code; that intermediate code is compiled by the JIT compiler, and the jitted code is executed by the .NET run-time engine. The objects you have told the compiler you want to create instances of have had had memory allocated for them, and that memory is used to hold the data for the object's internal structure.

What you have at run-time are references to these instantiated objects which you can use to access the internal data and state of the objects that is exposed.

An instantiated object is not a copy of a Class, or Struct, or whatever, just as a house is not a copy of a set of blueprints.


和对象是一个类型的声明,它的属性,方法等等:实例是你可以操作的类型的例子。



想想汽车:汽车是对象,但我的车,你的车,这辆车和那辆车都是实例。您可以开车,但是需要它的实例才能到达商店!
And object is the declaration of a type, which it's properties, methods and so forth: and instance is the example of the type that you can manipulate.

Think of cars: Car is the object, but "my car", "your car", "this car", and "that car" are the instances. You may be able to "drive a Car", but you need an instance of it to get to the shops!


实例是表示Object的Class的唯一副本。 br />
类是用于创建对象的模板/蓝图。



参考:



1)什么是实例和对象之间的区别?



2)类vs对象vs实例



3)对象和实例之间的差异:C ++
An instance is a unique copy of a Class that representing an Object.
Class is a "template" / "blueprint" that is used to create objects.

Refer :

1 ) What is the difference between an Instance and an Object?

2 ) Class vs Object vs Instance

3 ) Difference between Object and instance : C++


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

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