Show TOC

Pull-up Members to SuperclassLocate this document in the navigation structure

You can move member definitions (for example, constants, attributes, methods, types, and events) from a subclass and to its superclass.

Prerequisites

This functionality is provided in SAP NetWeaver Release 7.40 SP08 and higher.

Context

Example

Before Execution After Execution

To copy the source code example, click here Code Example Before Execution

The cl_car class contains the speed attribute and implements the cl_vehicle superclass.

The declarion of the speed attribute has been removed from the cl_car class and added to the cl_vehicle superclass.

The visibility of the attribute has been changed from private to protected in order to make it available for the cl_car subclass.

Procedure

  1. In the implementation, select the member that you want to move to the protected section of the superclass.
  2. Get the quick assist proposals by choosing Quick Fix from the context menu (shortcut Ctrl 1) or by using the Quick Assist view.
  3. Apply Pull-up Attribute to Super Class.