CS : 16 Object Oriented Systems of December 1999
Quesetion Paper of CS-16: Object Oriented Systems
Qnsl(a) Define the following terms with examples:
(i) Overloading
(ii) Templates
(iii) Multiple inheritance and Multilevel inheritance
(iv) Base and Derh ed classes.
Ql(b) Define a class for storing, evaluating and printing simple arithmetic expressions consisting of. Integer constants and the operators +, -, * and /. The public interface should look like this:
class expr {
//
public:
expr(char *);
int eval( );
void print( );};
The string argument for the constructor
expr:: expr() is the expression. The function
expr: : eval() returns the value of the expression, and
expr : : print() prints a representation of the expression on the
cout. A program might look like this:
exprx("123/4+123*4-3″);
cout “x =” x eval( ) “n";
x.print( );
Define class expr twice: once using a linked list of nodes as the representation and once using a character string as the representation.
Ql © Design a template class for sorting a list of elements.