3.7. Reference types

Reference types got their name because they contain references to the objects allocated on the heap. Such types can contain null references and are always passed by reference. This means that an address of the object, not the object itself, is passed to a procedure or function, meaning that changes will be made to the object, not its copy, as we have seen in the previous example for structures. The main reference type is a class – we will learn about this type in the next section.

Classes

By definition, a “class” is a data structure that may contain data members (constants, variables, and events), function members (methods, properties, indexers, operators, and constructors), and nested types. One important note about classes ...

Get A Programmer's Guide to .NET now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.