编程中实例的含义是什么? [英] what is meaning of instance in programming?
问题描述
我不会太久了.还有其他类似于实例"的单词更容易理解吗?对于非程序员,您如何解释实例?实例就像普通人的世界中的例子.如果我什至不了解它的含义,我将无法理解.
I don't get it for long. Any alternative word similar to 'instance' that is easier to understand? For non-programmer, how you explain instance? instance is like example in normal peoples' world. I can't understand what is it if I don't even got its meaning.
推荐答案
"instance"最好的理解是因为它与类别"有关.在编程中.类"用于定义事物的类别的属性和行为.例如.一辆汽车"班级可能会规定所有汽车都应根据其品牌,型号,年份和里程数来定义.
"instance" is best understood as it relates to "class" in programming. "Classes" are used to define the properties and behavior of a category of things. E.g. A "Car" class might dictate that all cars be defined by their make, model, year, and mileage.
但是您不能提供有关特定汽车的详细信息(例如,您的叔叔米奇驾驶的那辆1978 Chevy Impala行驶了205,000英里),直到您创建了实例"引擎.汽车.实例捕获有关一辆特定汽车的详细信息.
But you can't provide specifics about a particular car (for example, that 1978 Chevy Impala with 205,000 miles on it that your uncle Mickey drives) until you create an "instance" of a Car. It's the instance that captures the detailed information about one particular Car.
这篇关于编程中实例的含义是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!