Java Reference
In-Depth Information
Rectangle
Window
Area()
int width
int height
WinArea(Rectangle rect)
WinArea(Circle circ)
Circle
Area()
Figure17-3AcquaintanceAssociation
Programmersnote:
Inordertodistinguishobjectcompositionbyaggregationandbyac-
quaintanceinaclassdiagram,weuseasolidlinetorepresentaggrega-
tionandadashedlineforacquaintance,asin Figure17-3 .
Thefollowingprogram,namedAcquaintance.java,implementsthe
classdiagramin Figure14-2 .
On the Web
The source file for the program Acquaintance.java can be found in the
Chapter17folderat www.crcpress.com .
//**********************************************************
//**********************************************************
// Program: Acquaintance
// Reference: Chapter 17
// Topics:
// 1. The acquaintance relationship
//**********************************************************
//**********************************************************
//******************************************
// Rectangle class
//******************************************
class Rectangle
{
// Method Area()
 
Search WWH ::




Custom Search