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

After installing a new video card, the computer displays no video output. Which of the following is the most likely cause?

A) The video cable must be upgraded to accommodate the new capabilities of the video card. B) The video card is defective. C) The video card is incompatible with the system. D) The video card does not have the power connector attached.

Computer Science & Information Technology

When following a mobile-first strategy, a mobile user must be presented with desktop content also.?

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

Computer Science & Information Technology