betterbasicbox.java

来自「国外的数据结构与算法分析用书」· Java 代码 · 共 18 行

JAVA
18
字号
/**	A class that extends BasicBox to include a version of equals 
	that is defined for a parameter of type Object. */
public class BetterBasicBox extends BasicBox
{
	/**	Constructor for a box. */
	public BetterBasicBox(int l, int w, int h)
	{
		super(l, w, h);
	}

	/**	Does this box have equal variable values as object other? */
	public boolean equals(Object other)
	{
		BetterBasicBox otherBox = (BetterBasicBox) other;
		return length == otherBox.length & width == otherBox.width & height == otherBox.height;
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?