I have been interviewed by many people in my life. Interviewers often go with simple root level questions like what is an object.
Many candidates often get confused with simple questions ! One of them is given below..
Object — Definition and Small Explaination
1. Object is a concrete entity that exists in time and space.
2. An object has 3 things.
3. The state and behaviour of similar objects are defined in their common class.
4. The words Instance and objects are interchangeable.
5. State of an object consists of properties i.e member variables with their dynamic values.
6. Behaviour means how an object reacts and acts when state changes and message passing. Behaviour means functions or methods defined in a class.
7. Identity is the property of an object which distinguishes it from all other objects.
8.A class or struct definition is like a blueprint that specifies what the type can do.
9. An object is basically a block of memory that has been allocated and configured according to the blueprint. A program may create many objects of the same class.
10.Objects are also called instances, and they can be stored in either a named variable or in an array or collection. Client code is the code that uses these variables to call the methods and access the public properties of the object.
11.In an object-oriented language such as C#, a typical program consists of multiple objects interacting dynamically.
12. Please go through the example given taken from MSDN.
public int i = 10;
static void Main()
a = 1; // an example of boxing
a = new SampleClass();
classRef = (SampleClass)a;