Chapter 10

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

has-a relationship

Aggregation is a special form of association that represents an ownership relationship between two objects. Aggregation models has-a relationships. The owner object is called an aggregating object, and its class is called an aggregating class. The subject object is called an aggregated object, and its class is called an aggregated class.

aggregation

Aggregation is a special form of association that represents an ownership relationship between two objects. Aggregation models has-a relationships. The owner object is called an aggregating object, and its class is called an aggregating class. The subject object is called an aggregated object, and its class is called an aggregated class. An object can be owned by several other aggregating objects. If an object is exclusively owned by an aggregating object, the relationship between the object and its aggregating object is referred to as a composition. For example, "a student has a name" is a composition relation- ship between the Student class and the Name class, whereas "a student has an address" is an aggregation relationship between the Student class and the Address class, since an address can be shared by several students.

composition

Aggregation is a special form of association that represents an ownership relationship between two objects. Aggregation models has-a relationships. The owner object is called an aggregating object, and its class is called an aggregating class. The subject object is called an aggregated object, and its class is called an aggregated class. An object can be owned by several other aggregating objects. If an object is exclusively owned by an aggregating object, the relationship between the object and its aggregating object is referred to as a composition. For example, "a student has a name" is a composition relation- ship between the Student class and the Name class, whereas "a student has an address" is an aggregation relationship between the Student class and the Address class, since an address can be shared by several students.

class abstraction

Class abstraction is the separation of class implementation from the use of a class. The details of implementation are encapsulated and hidden from the user. This is known as class encapsulation.

boxing

Converting a primitive value to a wrapper object is called boxing. The reverse conversion is called unboxing. Java allows primitive types and wrapper classes to be converted automati- cally. The compiler will automatically box a primitive value that appears in a context requir- ing an object, and will unbox an object that appears in a context requiring a primitive value. This is called autoboxing and autounboxing.

unboxing

Converting a primitive value to a wrapper object is called boxing. The reverse conversion is called unboxing. Java allows primitive types and wrapper classes to be converted automati- cally. The compiler will automatically box a primitive value that appears in a context requir- ing an object, and will unbox an object that appears in a context requiring a primitive value. This is called autoboxing and autounboxing.

multiplicity

Each class involved in an association may specify a multiplicity, which is placed at the side of the class to specify how many of the class's objects are involved in the relationship in UML

abstract data type (ADT)

Java provides many levels of abstraction, and class abstraction separates class implementation from how the class is used. The creator of a class describes the functions of the class and lets the user know how the class can be used. The collection of methods and fields that are accessi- ble from outside the class, together with the description of how these members are expected to behave, serves as the class's contract. As shown in Figure 10.1, the user of the class does not need to know how the class is implemented. The details of implementation are encapsulated and hidden from the user. This is called class encapsulation. For example, you can create a Circle object and find the area of the circle without knowing how the area is computed. For this reason, a class is also known as an abstract data type (ADT).

class encapsulation

Java provides many levels of abstraction, and class abstraction separates class implementation from how the class is used. The creator of a class describes the functions of the class and lets the user know how the class can be used. The collection of methods and fields that are accessi- ble from outside the class, together with the description of how these members are expected to behave, serves as the class's contract. As shown in Figure 10.1, the user of the class does not need to know how the class is implemented. The details of implementation are encapsulated and hidden from the user. This is called class encapsulation. For example, you can create a Circle object and find the area of the circle without knowing how the area is computed. For this reason, a class is also known as an abstract data type (ADT).

class's contract

Java provides many levels of abstraction, and class abstraction separates class implementation from how the class is used. The creator of a class describes the functions of the class and lets the user know how the class can be used. The collection of methods and fields that are accessi- ble from outside the class, together with the description of how these members are expected to behave, serves as the class's contract. As shown in Figure 10.1, the user of the class does not need to know how the class is implemented. The details of implementation are encapsulated and hidden from the user. This is called class encapsulation. For example, you can create a Circle object and find the area of the circle without knowing how the area is computed. For this reason, a class is also known as an abstract data type (ADT).

stack

stack is a data structure that holds data in a last-in, first-out fashion


Ensembles d'études connexes

Chapter 14, Section 2: Chemical Formulas and Equations

View Set

Pardoner's Tale Discussion Questions

View Set