Let’s summarize this chapter:
Classes and structs share common features but have big differences.
Classes are reference types. The
newkeyword constructs an anonymous class object and returns a class variable.
Class variables that are not associated with any object are
null. Checking against
nullmust be done by
!is, not by
The act of copying associates an additional variable with an object. In order to copy class objects, the type must have a special function likely named
Assignment associates a variable with an object. This behavior cannot be changed.