Chapter 4: Let Me Say This about this
In This Chapter
Figuring out how to pass an object to a method
Comparing class methods to instance methods
Knowing what to do when you don’t have
Taking action when a class doesn’t have a method that you need it to have
This chapter moves from the static methods that Chapter 3 in this minibook emphasizes to the nonstatic methods of a class. Static methods belong to the whole class, and nonstatic methods belong to each instance created from the class. Important differences exist between static and nonstatic class members.
Passing an Object to a Method
You pass object references as arguments to methods in the same way as you pass value-type variables, with one difference: You always pass objects by reference.
The following small program demonstrates how you pass objects — to methods, that is:
// PassObject -- Demonstrate ...