In an interview I was asked a question, and I could not answer it ... Here is a question
My answer was a different name object... what is the correct answer for this question ...
object
The instance belongs to the class, as the cake is a recipe. Each time you use the constructor to create an object, you create an instance.
I would describe the instance as a single copy of the object. There may be one, there may be thousands, but the instance is a specific copy to which you can have a link.
MyObject obj = new MyObject();
- , - .
"" - , , "", , (, : , ..) .NET(, WinForm?) .NET; Enum.
"" "", , , , / , , "". , .
- " ", " -".
yup, , "" . - , .
, /. , .
...
, "" - , , , , , . , Ford Fiesta, 1.6 EXI 2009 , . , .
, , , #. , .
, , , .
, ;
:
- .
var John = new Person();
John, Person(). Person() , , .
, " " "", INSTANCE , OOP OBJECT.
int x = 5;
Everything is the same here. x is the name of a memory location that has 4 bytes of capacity for storing an integer. Another thing here is x - this is INSTANCE for int, but not for the object.
An instance is synonymous with an object, and when we create an object of a class, we say that we create an instance of the class
in a simple copy of the word means creating a link to the object (a copy of the object at a specific time) and the object is referenced to the memory address of the class