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 (4th Edition)
Additional Engineering Textbook Solutions
Concepts Of Programming Languages
Java: An Introduction to Problem Solving and Programming (8th Edition)
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
Degarmo's Materials And Processes In Manufacturing
Database Concepts (8th Edition)
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
- In single inheritance, a class exists in a(n)_____________ relationship with its derived classesarrow_forwardThe properties of a child class are inherited by the parent class. Select one: True Falsearrow_forwardIn order to extend a class, the new class should have access to all the data and inner workings of the parent class. True Falsearrow_forward
- C#(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_forwardThe 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_forward
- When 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: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_forward
- Programming 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_forwardExercise 1-Account class • Design a class named Account that contains : • A private int data field named id for the account • A private double data field named balance for the account • A privet Date data field named dateCreated that stores the date when the account was created • A no-arg constructor that creates a default account • A constructor that creates an account with the specified id and initial balance • The getters (i.e., accessors) and setters (i.e., mutators) methods for id and balance • The getter method for dateCreated • A method named withdraw that withdraws a specified amount from the account • A method named deposit that deposits a specified amount to the accountarrow_forwardA constructor has the same name as the class and is automatically called when a new object of the class is created. It is used to perform initialization functions. A constructor may or may not have input arguments. The keyword extends is used to indicate inheritance. Class B extends Class A implies that Class B is inheriting the attributes and methods of class A. Class A is the base class and Class B is the derived class. It is also possible for the derived class to reference the constructor of the base class in its constructor. This will avoid duplicating initialization functions. note:write the java code and don't use any packagearrow_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