Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For each pair of specifications below, state whether the extending class is a true subtype of its superclass or not. Explain why you chose the

For each pair of specifications below, state whether the extending class is a true subtype of its superclass or not. Explain why you chose the answer that you did.

1. class Triangle { // modifies: this // effects: this_post.a=a, this_post.b=b, this_post.c=c void setSides(int a, int b, int c); } class IsoscelesTriangle extends Triangle { // modifies: this // effects: this_post.a=a, this_post.b=b, this_post.c=b void setSides(int a, int b, int c); } 
2. abstract class Vertebrate extends Animal { // returns: an integer > 0 int neckBones(); } class Squid extends Vertebrate { // returns: 0 neck bones int neckBones(); } class Human extends Vertebrate { // returns: 7 neck bones int neckBones(); } 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

MongoDB Applied Design Patterns Practical Use Cases With The Leading NoSQL Database

Authors: Rick Copeland

1st Edition

1449340040, 978-1449340049

More Books

Students also viewed these Databases questions