tail.java
来自「java装饰模式。通过装饰完成对上层类的封装。」· Java 代码 · 共 20 行
JAVA
20 行
import java.io.*;
public class tail extends abs
{
abs theAbs;
/*the tail to tell the final cost of all the goods you buy*/
public tail(abs theAbs)
{
this.theAbs=theAbs;
}
public void display()
{
theAbs.display();
System.out.println("-----------------------------------------------\n");
System.out.println("Total "+theAbs.getFinalCost());
}
public double getFinalCost()
{
return theAbs.getFinalCost();
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?