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: ____________________


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)____________

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...

You should arrange multiple catch blocks in order from the most general to the most specific.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

________ are graphic characters that can be formatted as text

Fill in the blank(s) with correct word

Computer Science & Information Technology

When are master pages most useful?

What will be an ideal response?

Computer Science & Information Technology

The customer open order file is used to

A. respond to customer queries B. fill the customer order C. ship the customer order D. authorize customer credit

Computer Science & Information Technology