MYPROGRAMMINGLAB WITH PEARSON ETEXT
MYPROGRAMMINGLAB WITH PEARSON ETEXT
8th Edition
ISBN: 9780134225340
Author: Deitel
Publisher: PEARSON
bartleby

Concept explainers

Question
Book Icon
Chapter 20, Problem 20.3E
Program Plan Intro

To explain how the polymorphism enables “in general” rather than specific ad also to explain its key advantages in programming.

Expert Solution & Answer
Check Mark

Explanation of Solution

Polymorphism is a Greek word where ‘poly’ means many and ‘morphism’ means forms. Thus, polymorphism is defined as the ability to acquire many forms. It can be used to develop programs which processes class objects that belong to same hierarchy of class as if all objects belong to base class in the hierarchy.

In polymorphism the base class object is set equal to the sub class objects. Thus, the base class behaves differently depending upon the functionality of sub classes.

Polymorphism helps us to ‘program in general’ and not ‘in specific’.

The advantages enabled by Polymorphism to program ‘in the general’ are given below:

  • It focuses on general operations applied to all objects constructed from a class in the class hierarchy.
  • It helps provide a general behavior in the code that can be used by all subclasses besides the specific code of each subclass that distinguish their functionality.
  • It enables us to separate the general code from the specific code.
  • It also facilitates the code extension by including new features in the class without such modification.
  • The base class contains a set of member functions which all the subclasses inherit and provide their own definitions.

The advantages of programming “in general” are given below:

  • It supports the re-usability of the code.
  • The code can be easily extended and new functionality can be added to the existing code without such modification.
  • It also helps in reducing the complexity of the code.
  • It provides robustness in the program.

Want to see more full solutions like this?

Subscribe now to access step-by-step solutions to millions of textbook problems written by subject matter experts!
Students have asked these similar questions
The distinction between polymorphism and abstraction is explained below.
Could you provide a quick definition of parametric polymorphism in a subprogram and give an example of its use?
In terms of debugging and profiling, what are the challenges associated with function objects, especially when they're nested or chained?
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education