barcodefontsoft.com

INHERITANCE AND GENERALIZATION/SPECIALIZATION in Software Draw barcode code39 in Software INHERITANCE AND GENERALIZATION/SPECIALIZATION

4.3 INHERITANCE AND GENERALIZATION/SPECIALIZATION using barcode integration for software control to generate, create code 3 of 9 image in software applications. Radio-frequency identification Inheritance is a use barcode 3/9 for None ful abstraction mechanism in analysis and design. Inheritance naturally models objects that are similar in some, but not all, respects; thus, the objects have some common properties as well as unique properties that distinguish them. Inheritance is a classi cation mechanism that has been widely used in other elds.

An example is the taxonomy of the animal kingdom, in which animals. Overview are classi ed as mam 3 of 9 barcode for None mals, sh, reptiles, and so on. Cats and dogs have common properties that are generalized into the properties of mammals. However, they also have unique properties (e.

g., a dog barks and a cat mews). Inheritance is a mechanism for sharing and reusing code between classes.

A child class inherits the properties (encapsulated data and operations) of a parent class. It can then adapt the structure (i.e.

, encapsulated data) and behavior (i.e., operations) of its parent class.

The parent class is referred to as a superclass or base class. The child class is referred to as a subclass or derived class. The adaptation of a parent class to form a child class is referred to as specialization.

Child classes may be further specialized, allowing the creation of class hierarchies, also referred to as generalization/specialization hierarchies. Class inheritance is a mechanism for extending an application s functionality by reusing the functionality speci ed in parent classes. Thus, a new class can be incrementally de ned in terms of an existing class.

A child class can adapt the encapsulated data (referred to as instance variables) and operations of its parent class. It adapts the encapsulated data by adding new instance variables. It adapts the operations by adding new operations or by rede ning existing operations.

It is also possible for a child class to suppress an operation of the parent; however, such suppression is not recommended, because in that case the subclass no longer shares the interface of the superclass. Consider the example of bank accounts given in Figure 4.9.

Checking accounts and savings accounts have some attributes in common and others that are different. The attributes that are common to all accounts namely, account Number and balance are made attributes of an Account superclass. Attributes speci c to a savings account, such as cumulative Interest (in this bank, checking accounts do not accumulate any interest), are made attributes of the subclass Savings Account.

Attributes speci c to a checking account, such as last Deposit Amount, are made attributes of the subclass Checking Account.. # accountNumber : In teger # balance : Real = 0 + readBalance () : Real + credit (amount : Real) + debit (amount : Real) + open (accountNumber : Integer) + close (). - lastDepositAmount : Real = 0 - cumulativeInterest : Real = 0 + credit (amount : Real) + readLastDepositAmount() : Real + addInterest (interestRate : Real) + readCumulativeInterest () : Real Figure 4.9. Example of a generalization/specialization hierarchy Software Design and Architecture Concepts For each of the subc Code 3 of 9 for None lasses, new operations are added. For the Savings Account subclass, the new operations are read Cumulative Interest to read cumulative Interest, and add Interest to add the daily interest. For the Checking Account subclass, the new operation is read Last Deposit Amount.

This example is treated in more detail in 14.. 4.4 CONCURRENT PROCESSING An object may be act Software Code39 ive or passive. Whereas objects are often passive that is, they wait for another object to invoke an operation and never initiate any actions some object-oriented methods and languages, such as Ada and Java, support active objects. Active objects, also referred to as concurrent objects, execute independently of other active objects.

. 4.4.1 Sequential and Concurrent Applications A sequential applica Software barcode 3 of 9 tion is a sequential program that consists of passive objects and has only one thread of control. When an object invokes an operation in another object, control is passed from the calling operation to the called operation. When the called operation nishes executing, control is passed back to the calling operation.

In a sequential application, only synchronous message communication (procedure call or method invocation) is supported. In a concurrent application, there are typically several concurrent objects, each with its own thread of control. Asynchronous message communication is supported, so a concurrent source object can send an asynchronous message to a concurrent destination object and then continue executing, regardless of when the destination object receives the message.

If the destination object is busy when the message arrives, the message is buffered for the object..
Copyright © barcodefontsoft.com . All rights reserved.