Concept explainers
In an inheritance relationship, the ___________ is the general class.
a. subclass
b. superclass
c. slave class
d. child class
In an inheritance relationship, the superclass is referred as “General class”.
Hence, the correct answer is option is “B”.
Explanation of Solution
Inheritance:
In python, it is possible to construct a new class that inherits the members of an existing class, which is referred as “inheritance”.
“is a” relationship in inheritance:
In python, if one object is a specialized kind of another object, then there should be an “is a” relationship between those objects. This is used to create the “is a” relationship among several classes.
For example:
- A truck is a vehicle.
- A circle is a shape.
Super class and sub class:
In python, the inheritance concept involves two classes. They are superclass and subclass.
- A superclass is also referred as “general class” or “base class” and a subclass is referred as “specialized class” or “derived class”.
- The sub class is an extended kind of the superclass. This means a subclass can inherit the attributes and class member functions from the superclass without rewriting them in the subclass.
- Extra methods can be added in the subclass, which implies the specialized kind of the superclass.
Explanation for the incorrect options:
In inheritance, a subclass is referred as “specialized class” or “derived class”.
Hence, option “A” is wrong.
In inheritance, slave class is not present.
Hence, option “C” is wrong.
In inheritance, a subclass is referred as “specialized class” or “derived class” or child class.
Hence, option “D” is wrong.
Want to see more full solutions like this?
Chapter 11 Solutions
Starting Out with Python (3rd Edition)
Additional Engineering Textbook Solutions
Starting Out with C++ from Control Structures to Objects (9th Edition)
Absolute Java (6th Edition)
Starting Out with C++: Early Objects
Database Concepts (8th Edition)
Starting Out With Visual Basic (8th Edition)
Starting Out with Java: From Control Structures through Data Structures (3rd Edition)
- In single inheritance, a class exists in a(n)_____________ relationship with its derived classesarrow_forward___________ is an Object-Oriented programming feature that allows you to define new classes from existing classes. 1 Overriding 2 Overloading 3 Inheritance 4 Polymorphismarrow_forwardThe properties of a child class are inherited by the parent class. Select one: True Falsearrow_forward
- In order to extend a class, the new class should have access to all the data and inner workings of the parent class. True Falsearrow_forwardC#(Sharp): In an inheritance relationship, the ________________ is the general class Base class Master class Derived class Parent classarrow_forwardThe entire list of parent classes from which a child class is derived constitutes the ____ of the subclass. a. children b. derivatives c. subordinates d. ancestorsarrow_forward
- The super keyword is used in a subclass constructor to explicitly control the superclass constructor that must be invoked before the execution of the subclass constructor proceeds. * True O Falsearrow_forwardWhen deriving a class with public inheritance, public members of the base class become _________members of the derived class, and protected members of the base classbecome______________ members of the derived class.arrow_forwardCreate an Employee Class with the ff: attributes: = String name = double salary = String birthday = __init__(self, name, salary, birthday) = String getDetails() -- returns a String value that represents all the information of the Employee object Create a Manager class that inherits Employee, a Manager will also have the ff: = String department = __init__(self, name, salary, birthday, department) = String getDetails() -- returns a String value that represents all the information of the Manager object Create a Director class that inherits Manager, a Director will also have the ff: = double carAllowance = __init__(self, name, salary, birthday, department, carAllowance) = def playGolf() -- will print a string value '{name of director} plays golf' = String getDetails() -- returns a String value that represents all the information of the Director object Create 2 objects of each class and call their respective getDetails() method. Do not write WET codes, be sure there's no…arrow_forward
- Inheritance is an OOP concept such that a class can be defined in different ways, such as either being typecasted to itself (as a subclass) or any of its superclasses. True Falsearrow_forward:Single inheritance means one class inheriting from one super classes more classes inheriting from one super class more classes inheriting from more super classes None of the abovearrow_forwardProgramming Language = Python 1. Employee and ProductionWorker Classes Write an Employee class that keeps data attributes for the following pieces of information: • Employee name • Employee number Next, write a class named ProductionWorker that is a subclass of the Employee class. The ProductionWorker class should keep data attributes for the following information: • Shift number (an integer, such as 1, 2, or 3) • Hourly pay rate The workday is divided into two shifts: day and night. The shift attribute will hold an integer value representing the shift that the employee works. The day shift is shift 1 and the night shift is shift 2. Write the appropriate accessor and mutator methods for each class. Once you have written the classes, write a program that creates an object of the ProductionWorker class and prompts the user to enter data for each of the object’s data attributes. Store the data in the object and then use the object’s accessor methods to retrieve it and display it on the…arrow_forward
- Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning