schaum@praetor.rutgers.edu (schaum) (12/08/90)
I and my group partners are constructing a calculator which operates on integers, matrices and sparse matrices. Our current heirarchy is as follows: Operand | /|\ / | \ Integer | Sparse | Matrix Class operand is an abstract class containing no data and only virtual member functions which are defined in the subclasses. Our goal is to produce a client class Calculator which evaluates expressions in reverse Polish notation, doing addition, subtraction and multiplication on objects of subclasses of operand, passing parameters of type operand in order to be able to pass any of the subclasses as parameters. In Eiffel, this would be the case, that something of operand could be assigned any of the subclasses. Can this be done in C++, or are we WAY off base on this one? Suggestions are VERY welcome! (i.e., could we say: operator *op1, *op2; op1 = new integer; op2 = new matrix; //this yields errors, so obviously, we screwed up.) :Chaz: schaum@remus.rutgers.edu -- o ___ ___ o Old enough to know, / / / /| / but young enough not to care. / /--/ /-| -/- o /___ / / / | /__ o Snagglepuss evannahh!