(Stroustrup, Design and Evolution of C++, page 411ff) In each of a) through i), which variable is a local variable? Which statement makes names from a namespace available? (What namespace?) Which are an error? (If so, why?) Which introduce a variable from a namespace? (What namespace?) Which hide a global variable?
```
#include
namespace X
{
int i, j , k;
}
int k;
void f1()
{
int i = 0;
using namespace X; //a)
i++; //b)
j++; //c)
k++; //d)
::k++; //e)
X::k++; //f)
using X::i; //g)
using X::k; //h)
using std::cout; //i)
}
```
Part a) makes names from namespace X available, part b) is the local variable i. Part c) is X::j. Part d) is an error: ambiguous – is this X::k or the global k? Part e) increments the global k. Part f) is explicitly X’s k. Part g) is an error, i is declared twice. Part h) hides the global k. Part i) introduces cout from namespace std.
You might also like to view...
A PowerPoint theme is a collection of design elements, fonts, colors, and graphics that create a uniform look for a presentation
Indicate whether the statement is true or false
The Insert Record behavior enables you to specify which data you want to retrieve from the database and display in the Web page.
Answer the following statement true (T) or false (F)
What is the file extension for an Access 2016 database file?
A) .accdb B) .aacdb C) .mdb D) .dbf
Case WD 2-1Jayson will be applying for a job soon, so he is creating and formatting his resume. Which button can Jayson use to change a heading to all capital letters?
A. Superscript B. Subscript C. Change Case D. Grow Font