
# 内联超类
此重构操作允许将超类的成员移动到子类中，并删除超类。这与[提取超类](https://support.huaweicloud.com/usermanual-codeartside/codeartside_01_0132.html)相反。
#### 执行重构
1. 在代码编辑器中，将光标放在用户想要内联的超类的声明或引用位置。
2. 单击右键展示上下文菜单，选择**"重构 \> 内联超类..."**。
3. 在打开的**"内联超类"** 对话框中，选择内联所有引用并删除超类。如下图所示：
   
   图1内联超类   
   ![](https://support.huaweicloud.com/usermanual-codeartside/zh-cn_image_0000002365336540.png)
   
   
4. 单击**"重构"**以应用重构操作。
 
#### 示例
举个例子，将类**InlineSuperClass** 内联并删除，将其成员移动到**SubClass**中。
**重构前**
"com\\refactoring\\source\\SubClass.java"文件内容如下：
```
class InlineSuperClass {
    public int returnValue() { ... }
    public int returnNewValue() { ... }
}
class SubClass extends InlineSuperClass {
    private int myValue;
    int someMethod() {
        if (myValue > returnValue()) {
            return returnNewValue();
        }
        return 0;
    }
}
```
**重构后**
"com\\refactoring\\source\\SubClass.java"文件内容如下：
```
class SubClass {
    private int myValue;
    int someMethod() {
        if (myValue > returnValue()) {
            return returnNewValue();
        }
        return 0;
    }
    public int returnValue() { ... }
    public int returnNewValue() { ... }
}
```
