You have some sub-classes, some of which execute similar operations in the same order, but the details of each operation are different. Put these operations into independent functions, and keep them all with the same signature, so the original functions become the same, and then move the original functions to the superclass.
Motivation: inheritance is a powerful tool to avoid repeated behaviors. Whenever you see similar functions in the two subclasses, You can promote them to the superclass. But what if these functions are not exactly the same? It is still necessary to avoid repetition as much as possible, but the substantial difference between these functions must be maintained.
A common case is that the two functions perform roughly similar operations in the same order, but the operations are different. In this case, we can move the execution sequence to the superclass, and use polymorphism to ensure that each operation remains different. Such a function is called template method ).