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:

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.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Software Testing And Quality Assurance Questions!