Answered step by step
Verified Expert Solution
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
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 Started