Chapter 5: Objects and Methods


5.1 Introduction

A function, also known as a method, is the smallest modular unit; it carries out a single subtask in a class. Recall that classes are reusable units, which means that they can be used in another application. Functions are not reusable units because every function belongs to a class. From this point of view, a function is an internal decomposition unit.

A function can receive input data from another function when invoked; the input data passed from another function is called a parameter. The function can also return output data when it completes execution.

In its first part, this chapter describes class and function decomposition. The second part of the chapter discusses the basic mechanisms for data transfer between two functions; several examples are included.




Object-Oriented Programming(c) From Problem Solving to Java
Object-Oriented Programming (From Problem Solving to JAVA) (Charles River Media Programming)
ISBN: 1584502878
EAN: 2147483647
Year: 2005
Pages: 184

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net