Starting Out with C++: Early Objects (9th Edition)
Starting Out with C++: Early Objects (9th Edition)
9th Edition
ISBN: 9780134400242
Author: Tony Gaddis, Judy Walters, Godfrey Muganda
Publisher: PEARSON
bartleby

Videos

Textbook Question
Book Icon
Chapter 15, Problem 1RQE

A class that cannot be instantiated is a(n) _____ .

Expert Solution & Answer
Check Mark
Program Description Answer

The classes which cannot be instantiated are referred as “abstract base class”.

Explanation of Solution

Inheritance:

Inheritance is the concept of inheriting the members and properties of a base class from the derived class. The main advantages of inheritance are,

  • Code reusability and fast implementation.
  • Reduces the program code.

Abstract base class:

Abstract base class is a class which contains at least one pure virtual function.

  • Compiler will not permit the user to instantiate an abstract class.
  • Normally, in function the base class contains the implementation and the derived class overrides this implementation with its own implementation.
  • But, the class which inherits an abstract base class must provide definition to the pure virtual function.
    • The pure virtual functions implementation is not provided, and the function can be made pure virtual by adding (= 0) at the end of the function.
    • The pure virtual function is mostly implemented in the derived class and not in a base class.

Example for abstract base class with virtual function:

/*Abstract base class as it uses virtual function*/

class Base

{

/*Access specifier*/

public:

    /*virtual function*/

    virtual void disp() = 0

};

/*Virtual function definition*/

void Base::disp()     

{

    //statement;

}

Explanation:

In the above example,

  • Define the abstract base class with the name of “Base”.
    • Declare the pure virtual function with the name of “disp()” to make the class as the abstract class.
  • The implementation of pure virtual function “disp()” is not provided in base class. But, it is given outside of the class definition.
  • Hence, the abstract base class “Base” cannot be instantiated.

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
Problem Statement You are working as a Devops Administrator. Y ou’ve been t asked to deploy a multi - tier application on Kubernetes Cluster. The application is a NodeJS application available on Docker Hub with the following name: d evopsedu/emp loyee This Node JS application works with a mongo database. MongoDB image is available on D ockerHub with the following name: m ongo You are required to deploy this application on Kubernetes: • NodeJS is available on port 8888 in the container and will be reaching out to por t 27017 for mongo database connection • MongoDB will be accepting connections on port 27017 You must deploy this application using the CL I . Once your application is up and running, ensure you can add an employee from the NodeJS application and verify by going to Get Employee page and retrieving your input. Hint: Name the Mongo DB Service and deployment, specifically as “mongo”.
I need help in server client project. It is around 1200 lines of code in both . I want to meet with the expert online because it is complicated. I want the server send a menu to the client and the client enters his choice and keep on this until the client chooses to exit . the problem is not in the connection itself as far as I know.I tried while loops but did not work. please help its emergent
I need help in my server client in C language

Chapter 15 Solutions

Starting Out with C++: Early Objects (9th Edition)

Additional Engineering Textbook Solutions

Find more solutions based on key concepts
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
SEE MORE QUESTIONS
Recommended textbooks for you
  • Text book image
    EBK JAVA PROGRAMMING
    Computer Science
    ISBN:9781337671385
    Author:FARRELL
    Publisher:CENGAGE LEARNING - CONSIGNMENT
    Text book image
    Systems Architecture
    Computer Science
    ISBN:9781305080195
    Author:Stephen D. Burd
    Publisher:Cengage Learning
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Systems Architecture
Computer Science
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Cengage Learning
C++ Data Members; Author: CppNuts;https://www.youtube.com/watch?v=StlsYRNnWaE;License: Standard YouTube License, CC-BY