CIS 2430 Study Guide - Midterm Guide: Function Overloading, Static Variable, Class Variable

422 views5 pages

Document Summary

Identify two kinds of methods where privacy leak can usually happen in a class definition. By making a copy of the related object, we can keep the original copy intact, thus protecting the privacy of the original object: in the following illustration, class n has four instance variables: w, x, y, and z. Indicate inside each of the other four classes, which of these variables are accessible and which ones are not accessible. List two major differences between the two mechansims. Both use the same name for different methods. Overloading uses different signatures for the methods of the same name and multiple overloading methods can be defined in one class definition. We use files when the data needs to be saved permenantly or they are too large to be stored in. When using files, we should try to catch filenotfoundexception and close the file after it is fully used.