cppannotations/annotations/yo/first/namespaces.yo

16 lines
907 B
Text

bf(C++) introduces the notion of a emi(namespace): all symbols are defined
in a larger context, called a em(namespace). Namespaces are used to avoid
i(name conflicts) that could arise when a programmer would like to define
a function like tt(sin) operating on em(degrees), but does not want to lose
the capability of using the standard tt(sin) function, operating on
em(radians).
Namespaces are covered extensively in chapter ref(NAMESPACE). For now it
should be noted that most compilers require the explicit declaration of a
emi(standard namespace): tt(std). So, unless otherwise indicated, it is
stressed that all examples in the Annotations now implicitly use the
hi(using namespace std)
verb( using namespace std;)
declaration. So, if you actually intend to compile examples given in
the annotations(), make sure that the sources start with the above tt(using)
declaration.