Suppose the following code is embedded in an otherwise correct and complete program. Answer below the question about what version of f()is called in g().

```
void f(); //in the global namespace
namespace A
{
void f();
void g()
{
f(); //Does this call A::f()? Or the global f()?
}
}
```

a) The call is to the global f();
b) The call is to the namespace A version of f(), i.e., A::f();
c) There is an error. There is a conflict between the namespace f() and the global f(), so there is no call made at all
d) There are other errors that prevent the code from running


b) The call is to the namespace A version of f(), i.e., A::f();

b) A use of a name refer to a global version if not masked by a name defined in the name space prior to the use. c) There is no conflict between global namespace names and names defined in other namespaces.

Computer Science & Information Technology

You might also like to view...

Borders can be used to call attention to ________ on a worksheet

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

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

1. A structure declaration does not create anything in memory until you create a new instance of the structure. 2. Structures are value types, so a structure object contains all of its data at the variable’s memory location. 3. The programming terms instance and an object have the same meaning. 4. When you create a structure object with a simple declaration, the object's fields are initialized to their default values.

Computer Science & Information Technology