/* * @topic T10181 Feb 7, 2017 Inheritance Demo * @brief abstract class BaseBinaryOp used as a superclass (base class) */ package week03; public abstract class BaseBinaryOp { //------------------------------ // constants //------------------------------ public static final int ADD = 0; public static final int SUBTRACT = 1; //------------------------------ // data attributes //------------------------------ private int left; private int right; private int result; //------------------------------ // constructors //------------------------------ public BaseBinaryOp(int left, int right) { this.left = left; this.right = right; }//BaseBinaryOp //------------------------------ // operations //------------------------------ abstract public void compute(); protected void setResult(int result) { this.result = result; }//setResult public int getResult() { return result; }//getResult public int getLeft() { return left; }//getLeft public void setLeft(int left) { this.left = left; }//setLeft public int getRight() { return right; } public void setRight(int right) { this.right = right; }//setRight }//class BaseBinaryOp