Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Q4. Is this a good or bad use of inheritance? Why? (10 points) CLASS List { data: array [1..100] of INTEGER; count: INTEGER:= 0;

  

Q4. Is this a good or bad use of inheritance? Why? (10 points) 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 Stack pop(): INTEGER; ensure: remove and return value from end of Stack }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

The use of inheritance in this scenario is not ideal Heres why 1 Violation of Liskov Substitution Pr... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Finance Applications and Theory

Authors: Marcia Cornett, Troy Adair

3rd edition

1259252221, 007786168X, 9781259252228, 978-0077861681

More Books

Students also viewed these Programming questions

Question

3 When might constructivist view of self be not relevant and why?

Answered: 1 week ago

Question

x

Answered: 1 week ago