Question
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...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get StartedRecommended Textbook for
Finance Applications and Theory
Authors: Marcia Cornett, Troy Adair
3rd edition
1259252221, 007786168X, 9781259252228, 978-0077861681
Students also viewed these Programming questions
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
View Answer in SolutionInn App