Here is some code.There are only two outputs,one a message from the unnamed namespace the other a message from the Savitch namespace.Tell which line generates which message.
#include <iostream>
using namespace std;
namespace
{
void message();
}
namespace Savitch
{
void message();
}
int main()
{
{
message();//a)
Savitch::message();//b)
using Savitch::message;
message();//c)
}
message();//d)
return 0;
}
namespace Savitch
{
void message()
{
cout << "Message from NS Savitch\n";
}
}
namespace
{
void message()
{
cout <<"Message from unnamed NS\n";
}
}
1)List the letters of the lines that give the message from the unnamed namespace: ____________________
2)List the letters of the lines that give the message from the Savitch namespace: ____________________
Correct Answer:
Verified
View Answer
Unlock this answer now
Get Access to more Verified Answers free of charge
Q17: The include statement,#include <file.h> looks in the
Q18: The include statement,#include "file.h" looks first in
Q19: You can have a name spelled the
Q20: An unnamed namespace provides a facility for
Q21: The following program has been partitioned into
Q23: The following program has been partitioned into
Q24: Carefully distinguish the using directive
using namespace std;
from
Q25: The output from the following code is
"function".
(The
Q26: Given the namespace groupings that contain
Q27: You can declare several names from a
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents