Concept explainers
Mark the following statements as true or false.
In single inheritance, a base class can create only one derived class. (1)
The public members of a base class can only be inherited as public members in the derived class. (2)
To redefine (or override) a member function of the base class in the derived class, the corresponding member function must have the same name, number, and type of parameters. (3)
If the derived class does not override a public member function of the base class, you may specify a call to that public member function by using the name of the function and the appropriate parameter list. (3)
The constructor of a derived class can specify a call to the constructor of the base class in the heading of the function definition. (4)
The constructor of a derived class can specify a call to the constructor of the base class using the name of the class. (4)
Suppose that x and y are classes, one of the member variables of x is an object of type y, and both classes have constructors. The constructor of x specifies a call to the constructor of y by using the object name of type y. (4)
When the destructor of the derived class executes, it automatically invokes the destructor of the base class. (5)
The class ios is the base class for all stream classes. (7)
In protected inheritance, the private members of the base class are protected members of the derived class. (8)
In composition, one or more members of a class are objects of another class type. (9)
Inheritance allows creation of new classes from existing classes. The new classes that are created from the existing classes are called the derived classes; the existing classes arecalled the base classes. The derived classes inherit the properties of the base classes.
In single inheritance, a base class can create only one derived class. Hence, the given statement is “True”.
Explanation of Solution
In single inheritance,the derived class is derived from a single base class. In multiple inheritance, thederived class is derived from more than one base class.
Want to see more full solutions like this?
Chapter 11 Solutions
EBK MINDTAPV2.0 FOR MALIK'S C++ PROGRAM
- Assume the definition of class houseType as given in Exercise 11. Answer the following questions. (1, 2, 3, 5, 7) a. Write the definition of the member function set so that private members are set according to the parameters. b. Write the definition of the member function print that prints the values of the data members. c. Write the definition of the constructor of the class houseType so that the private member variables are initialized to according to the parameters. d. Write a C++ statement that prints the value of the object newHouse. e. Write a C + + statement that declares an object house of type newHouse, and initializes the member variables of house to "Ranch", 3, 2, 2, 2005, 1300, 185000, and 3600.0, respectively. f. Which function members are accessors and which are mutators?arrow_forwardThe technique of packaging an objects attributes into a cohesive unit that can be used as an undivided entity is ____________. a. inheritance b. encapsulation c. polymorphism d. interfacingarrow_forwardObject Oriented Programing Consider the following details of all classes: Person Student Employee Administration Dean/HOD A person can be an employee or a student. An employee may have rights of admin officer or of academic officer. These class hierarchies represent multi-level inheritance. However, a Dean or Head of Department(HOD) may have rights to modify the status already defined by an administrator academic officer. Implement all these classes with appropriate data members and proper suitable functions and within the main function, create instances of all classes and test the described working of all these classesarrow_forward
- Create a UML Class Model based on the requirements . Your Class Model is to include: All classes Attributes and Attribute Types Associations Multiplicity Primary and Foreign keys Any Inheritance, Composition or Aggregation. Building Maintenance system. A rental property management company wants to develop a ‘Building Maintenance System.’ This system will be used by the company to manage maintenance requests from tenants in the several rental buildings that it manages in the city. Each building has a maintenance manager. The maintenance manager is responsible for creating accounts in the system for each tenant in their building. A tenant can rent multiple apartments within the same building. Tenants can submit maintenance requests using this system. Each maintenance request will have a request ID, category, and description. The maintenance manager manages a maintenance crew in their building. Maintenance crew members can be members of more than one maintenance team. Maintenance crew…arrow_forwardС++ Multiple inheritance is When a class is derived from another class When a class is derived from other two derived classes When a class is derived from two or more classes When a class is derived from exactly one classarrow_forwardQ# In the company example, a supervisor has a supervisee. This “has-a” relationship is called: Group of answer choices 1. parent 2. composition 3. extending 3. inheritancearrow_forward
- SOLVE IN C# Package-delivery services, such as FedEx and DHL, offer a number of different shipping options, each with specific costs associated. Create an inheritance hierarchy described as follows to represent various types of packages: Use class Package as the base class of the hierarchy, Base class Package should include data members representing the name, address, city, state and ZIP code for both the sender and the recipient of the package, in addition to data members that store the weight (in ounces) and cost per ounce to ship the package. Package’s constructor should initialize these data members. Ensure that the weight and cost per ounce contain positive values. Package should provide a public member function calculateCost that returns a double indicating the cost associated with shipping the package. Package’s calculateCost function should determine the cost by multiplying the…arrow_forwardCreate a UML Class Model based on the requirements . Your Class Model is to include: All classes Attributes and Attribute Types Associations Multiplicity Primary and Foreign keys Any Inheritance, Composition or Aggregation Building Maintenance system A rental property management company wants to develop a ‘Building Maintenance System.’ This system will be used by the company to manage maintenance requests from tenants in the several rental buildings that it manages in the city. Each building has a maintenance manager. The maintenance manager is responsible for creating accounts in the system for each tenant in their building. A tenant can rent multiple apartments within the same building. Tenants can submit maintenance requests using this system. Each maintenance request will have a request ID, category, and description. The maintenance manager manages a maintenance crew in their building. Maintenance crew members can be members of more than one maintenance team. Maintenance crew…arrow_forwardA has-a relationship is implemented via inheritance.T/Farrow_forward
- A 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“Constructor cannot be inherited though derived class can call the base class constructor.” Justify the above example with example.arrow_forwardUse c# programming languagearrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage