Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
What is namespace? C++
What is namespace? C++
✍: Guest
Namespaces allow us to group a set of global classes, objects and/or functions under a name. To say
it somehow, they serve to split the global scope in sub-scopes known
as namespaces.
The form to use namespaces is:
namespace identifier { namespace-body }
Where identifier is any valid identifier and namespace-body is the set of classes, objects and
functions that are included within the namespace. For example:
namespace general { int a, b; } In this case, a and b are normal variables integrated within the
general namespace. In order to access to these variables from outside the namespace we have to
use the scope operator ::. For example, to access the previous variables we would have to put:
general::a general::b
The functionality of namespaces is specially useful in case that there is a possibility that a global
object or function can have the same name than another one, causing a redefinition error.
2012-02-13, 2832👍, 0💬
Popular Posts:
What is triple constraint triangle in project management ? Project Management triangle is depicted a...
.NET INTERVIEW QUESTIONS - What are Daemon threads and how can a thread be created as Daemon? Daemon...
What Does a HTML Document Look Like? A HTML document is a normal text file with predefined tags mixe...
What is triple constraint triangle in project management ? Project Management triangle is depicted a...
What is effort variance? Effort Variance = (Actual effort – Estimated Effort) / Estimated Effort.