Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

class Fish extends Animal Sub Let's say we have these three classes: class Animal Super class Cat extends Animal Subs int numflegs; void hunt(Animal animal)

image text in transcribed
class Fish extends Animal Sub Let's say we have these three classes: class Animal Super class Cat extends Animal Subs int numflegs; void hunt(Animal animal) double weight; double length; eat(animal.weight); void eat(double amount) weight = weight + amount; length = length + .01; void eat(double amount) weight = weight + amount; void poop(double amount) weight = weight - amount; Is there any different in what you can do with a 'Cat' object if you create it as an animal vs a cat? ex. Cat mr Meow = new Cat(); Animal mr Meow = new Cat(); (Hint: What properties and methods what be available in each case?) provient class, the Same question for the fish, is there any difference in what is available if you do the following? ex. Fish mrBubbles = new Fish(); or Animal mrBubbles = new Fish()

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

Seven Databases In Seven Weeks A Guide To Modern Databases And The NoSQL Movement

Authors: Luc Perkins, Eric Redmond, Jim Wilson

2nd Edition

1680502530, 978-1680502534

More Books

Students also viewed these Databases questions

Question

4 What are the main practices associated with SHRM?

Answered: 1 week ago