Assuming no other files are involved and that Dolores is not using any shared objects, what will happen when Dolores builds this program? Pick ONE option The code will compile and produce undefined behavior at runtime The code will compile but deterministically crash on the call to-doTheThing~in "akuna.cpp" because no implementation of the function is available in the executable The compiler will issue an error on the call to ~doTheThing~ in "akuna.cpp" because there is no implementation for the function The compiler will issue an error on the declaration of -doTheThing~ in "akuna.h" because there is no implementation for the function

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Topic Video
Question
Assuming no other files are involved and that Dolores is not using any shared objects, what will happen when Dolores builds this program?
Pick ONE option
The code will compile and produce undefined behavior at runtime
The code will compile but deterministically crash on the call to ~doTheThing~ in "akuna.cpp" because no implementation
of the function is available in the executable
The compiler will issue an error on the call to ~doTheThing~ in "akuna.cpp" because there is no implementation for the
function
The compiler will issue an error on the declaration of ~doTheThing~ in "akuna.h" because there is no implementation for
the function
The linker will issue an error on the call to ~doTheThing~ in "akuna.cpp" because there is no implementation for the
function
Transcribed Image Text:Assuming no other files are involved and that Dolores is not using any shared objects, what will happen when Dolores builds this program? Pick ONE option The code will compile and produce undefined behavior at runtime The code will compile but deterministically crash on the call to ~doTheThing~ in "akuna.cpp" because no implementation of the function is available in the executable The compiler will issue an error on the call to ~doTheThing~ in "akuna.cpp" because there is no implementation for the function The compiler will issue an error on the declaration of ~doTheThing~ in "akuna.h" because there is no implementation for the function The linker will issue an error on the call to ~doTheThing~ in "akuna.cpp" because there is no implementation for the function
Dolores has written the following simple program, spread over a single header file and a single implementation file:
// Header File "akuna.h"
#pragma once
namespace Akuna {
int doTheThing(int x, int y, int z) noexcept;
}
// Implementation File "akuna.cpp"
#include "akuna.h"
#include <iostream>
int main() {
}
int a, b, c;
std::cin >> a;
std::cin>> b;
std::cin >> c;
int result = Akuna: :doTheThing (a, b, c);
std::cout << result << std::endl;
return 0;
Transcribed Image Text:Dolores has written the following simple program, spread over a single header file and a single implementation file: // Header File "akuna.h" #pragma once namespace Akuna { int doTheThing(int x, int y, int z) noexcept; } // Implementation File "akuna.cpp" #include "akuna.h" #include <iostream> int main() { } int a, b, c; std::cin >> a; std::cin>> b; std::cin >> c; int result = Akuna: :doTheThing (a, b, c); std::cout << result << std::endl; return 0;
Expert Solution
Header File and Implementation File

The header file has the extension .h and contains the class definitions and functions. The class implementation goes in the .cpp file. By doing this, if your class the implementation hasn't changed so it won't need to be recompiled.


The header, implementation, and driver files must be in the same directory. If not, provide the current working directory link in the included instructions.

The header file has been used by programmers, is very useful and comes in handy when implementing various data structures and algorithms. For example, dynamic arrays can be implemented using the header file.

Advantages of storing class definitions in different files:

Inheritance can be used to achieve code reusability, but the downside is that a class must be inherited from a class inside the same file. You cannot inherit a class from another file.
However, this problem is solved by using header and executable files, thus making the class reusable.
If the class implementation has not changed, there is no need to recompile it.

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Instruction Format
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
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education