Inexperienced 00 programmers often implement the following class hierarchy, where a Stack class is defined to be

Question:

Inexperienced 00 programmers often implement the following class hierarchy, where a Stack class is defined to be a subclass of List:

CLASS List {

data: array (1 .. 100] of INTEGER;

count: INTEGER:= 0 ;

METHODS insert (pos: 1 .. 100; value: INTEGER);

require: insert value into List at position pos delete (pos: 1 .. 100 )

en•ure: remove value stored at position pos from List retrieve (pos : 1 . . 100): INTEGER;

enaure: return value stored at positi on pos in List CLASS Stack EXTENDS List METHODS push(value: INTEGER)

en•ure: append value to end of Stack pop(): INTEGER;

en•ure: remove and return value from end of Stack Explain why this is a bad use of inhe ritance.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: