Creating operations to be redefined

 

Creating operations to be redefined

Here we will be working with the "PatternToRedefine" package, which will allow us to automatically create operations which a class must redefine according to its generalization links.

 

The "PatternsToRedefine" package contains:

·         an "Animal" abstract class containing the "eat" abstract operation

·         a "Bird" abstract class which specializes "Animal" and which contains the "sing" abstract operation and the "fly" non-abstract operation

·         a "crow" class which specializes "Bird"

 

We will apply the pattern to the "Bird" class.

 

 

Initial model

 

Figure 59. The initial model

 

 

Calling the pattern

 

Figure 60. Calling the pattern

 

 

Final model

 

Figure 61. The model after transformation

 

 

Summary of the modifications made to the model

The "Crow" class has been enriched with the following operations:

·         "eat", which redefines the operation of the same name of the "Animal" class

·         "sing", which redefines the operation of the same name of the "Bird" class

 

However, the non-abstract "fly" operation has not been redefined.