Problem

Inexperienced OO programmers often implement the following class hierarchy, where a Stack...

Inexperienced OO 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)           ensure: remove value stored at position pos from List      retrieve (pos: 1..100),: INTEGER;           ensure: return value stored at position pos in List}CLASS Stack EXTENDS List {METHODS   push(value: INTEGER)       ensure: append value to end of Stackpop(): INTEGER;       ensure: remove and return value from end of Stack}

Explain why this is a bad use of inheritance.

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 6
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT