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 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:
____________________
What will be an ideal response?

1) List the letters of the lines that give the message from the unnamed namespace:
__a) and d)____________
2) List the letters of the lines that give the message from the Savitch namespace:
__b) and c)____________
Explanation: a) is a use of message() in a file with an unnamed namespace
containing a definition of message(). This is an invocation of the unnamed.
namespace function. b) is a use of a qualified name, Savitch::message().
This is a use of the name from the Savitch namespace. c) follows a using
declaration of message from the Savitch namespace, that is also a use of
message() from that namespace. The block ends, so the using declaration
expires, and the next message() is from the unnamed namespace again.

Computer Science & Information Technology

You might also like to view...

Macros are stored in ________

Fill in the blank(s) with correct word

Computer Science & Information Technology

Physical data flow diagrams:

A) include processes for adding, updating, changing and deleting records. B) are used to model business events, along with their input and output. C) enable the analyst to better understand the business. D) include no interface data flow in or out of processes.

Computer Science & Information Technology