Slick V3.3 manual 39. C++ Refactoring Extract Class

Models: V3.3

1 568
Download 568 pages 2.03 Kb
Page 230
Image 230

C++ Refactoring

Extract Class

Breaks a large class into a better abstraction by moving some responsibilities into a new class or inter- face. This refactoring creates new files. When using the Extract Class refactoring, keep in mind the follow- ing information:

The default path uses the same directory as the original class.

The default file names are the <class_name>.(cpp/h).

Default paths and file names can be changed.

The files will be added to the current project.

If version control is enabled, you are prompted to add the files to the version control system.

The new class will generate a default constructor, and a constructor that takes a parameter per mem- ber variable moved. Initializers in the original class' constructors for moved member variables are moved to the new class' constructors.

Figure 6.39. C++ Refactoring: Extract Class 1

Figure 6.40. C++ Refactoring: Extract Class 2

208

Page 230
Image 230
Slick V3.3 manual 39. C++ Refactoring Extract Class