Title Animal Class Hierarchy (Case 2)
Catalog Type SLCItem
Persistent ID https://acos.cs.vt.edu/html/acos-pcex/acos-pcex-examples/inheritance_animals__68bdb309f6cc3d7a9cc097ac?index=1
Platform Name PCEX
Features
Description Suppose we have a class Animal and we want to extend it to produce class Dog. An animal has a name. A Dog has a name and an owner. Write the class declarations, the constructors, and the toString methods for these two classes. Also, include a method called speak to print a string that represents an animal's and a dog's voice. We show the voice of an animal by printing its name. We show the voice of a dog by printing its name followed by the text Woof Woof.\n\nThe class AnimalTester2 tests these classes and their methods.
Keywords inheritance
Author Mohammad Hassany
Institution University of Pittsburgh
Iframe URL https://acos.cs.vt.edu/html/acos-pcex/acos-pcex-examples/inheritance_animals__68bdb309f6cc3d7a9cc097ac?index=1
Protocol SPLICE, HTML, PITT
Protocol URL
License MIT
Programming Language Java
Natural Language en

Preview

SPLICE Output