Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
4th Edition
ISBN: 9780134444321
Author: Tony Gaddis
Publisher: PEARSON
Expert Solution & Answer
Book Icon
Chapter 11, Problem 3SA

Explanation of Solution

Polymorphism:

In Python, one of the features of object-oriented concept is “polymorphism” and it refers an object’s capability to take different forms.

  • • It allows the subclass that may contain methods having same name as the method in its superclass.
  • • A program can call the correct method using the type of an object that may use to call it.

Method overridden:

In Python, if a subclass contains a method having the same name as the method in its superclass, then it is referred as “method overridden”.

Example:

Consider the following example for method over-riding:

#Base class "Student"

class Student(object):

         # class constructor

         def __init__(self, s_name):

              #Initialize student name

              self.s_name = s_name

         # To get student name

         def getname(self):

              #Return student name

              return self...

Blurred answer
Students have asked these similar questions
An existing solution is transformed into a computer program to build a new one. What is the name of the method?
When do e RAD methods work best?
What exactly does the term "debugging" entail?