namespace ExpressionHierarchy { interface IExpression { eval ( ) : number ; } abstract class BinaryExpression implements IExpression { readonly a : number ; readonly b : number ; constructor ( a , b ) { this . a = a ; this . b = b ; } abstract eval ( ) ; } class SumExpression extends BinaryExpression { eval ( ) { return this . a + this . b ; } } class MulExpression extends BinaryExpression { eval ( ) { return this . a * this . b ; } } }