{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Homework3 - CSE 335 Homework 3 Objectives Implement class...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
CSE 335 Homework 3 Objectives: Implement class hierarchies using abstract classes and pure virtual functions. Description: In class, we discussed how to design a class hierarchy to implement arithmetic expres- sion trees. For this exercise, you are to implement these classes and add an operation to compute the value of an expression tree. For the first part, you will need to implement the concrete classes: Literal represents an integer literal in an expression (e.g., the “23” and the “3” in the expression 23 - 3 ). Negate is a unary operator that changes the sign of another expression (e.g., in the expression - (23 + 4) the primary operator is negation). Add, Subtract, Multiply, and Divide are binary operators whose names should be self explana- tory. Initially, class Literal should merely provide an operation for returning its value, and the operator classes should provide operations for retrieving the expression or expressions upon which they operate.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}