4.3. Method Invocation and Dot Notation
Now that you understand how methods are formally specified, how do we represent in code that a method is being invoked on an object? The name of the reference variable representing the object that the method is called on is followed with a dot (period) and then the method (function) call. For example:
// Instantiate a Student object. Student x = new Student(); // A method is called on Student object x, asking it to // register for course MATH 101, section 10. x.RegisterForCourse("MATH 101", 10); // This is a method call
Because we are using a dot to "glue" the reference variable to the method name, this is informally known as dot notation. And, in referring to the following logic, we can describe this ...