October 2008
Beginner to intermediate
680 pages
16h 48m
English
Different OO languages differ in terms of when an object is actually instantiated (created). In C#, when we declare a variable to be of a user-defined type, such as the following, we haven't actually created an object in memory yet:
Student y;
Instead we simply declared a reference variable of type Student named y. This reference variable has the potential to refer to a Student object, but it doesn't refer to one just yet. We have to take the distinct step of using a special C# operator, the new operator, to actually carve out a brand-new Student object in memory and to then associate the new object with the reference variable y, as follows:
y = new Student();
NOTE
Behind the scenes, what we're actually ...
Read now
Unlock full access