p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Java Programming 24-Hour Trainer by Yakov Fain (http://p2p.wrox.com/forumdisplay.php?f=624)
-   -   Listing 4-4 (http://p2p.wrox.com/showthread.php?t=83070)

yfain March 26th, 2011 08:49 AM

Listing 4-4
 
I had a couple of requests to provide more explanations regarding Listing 4-4. This was an illustration of how an instance of the class A can pass a reference to itself to an instance B. For example, There is SomeOtherClass that knows how to verify Tax and as a result can later modify some public variable(s) on the object Tax.

The object Tax passes reference to itself verifyTax(this), the instance of SomeOtherClass can do some calculations and call a method to set the results on Tax.

There is a more concrete example of passing references between the objects on page 93, where Calculator (the UI class) passes the reference to itself to CalculatorEngine - this one does the calculations and then changes the display field content on the Calculator as in Listing 9-7.


All times are GMT -4. The time now is 11:03 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.