Advertisement
2002C Miscellaneous #16320

Namespace tutorial .

Explains namespaces.

AI

AI Samenvatting: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Broncode
original-source
<HTML>
<FONT COLOR="#BD0000" FACE="FIXEDSYS">
<B> Namespace tutorial </b><br><br>
A namespace groups together variables, functions, and classes. It is a mechanizim, for expressing logical grouping. For example, the functions for a string library, could be placed in a namespace called string. <br><br>
<pre>
namespace string {
void strcpy(char* source, char* from);
void strcat(char* source, char* from);
int strlen(char* source);
}
void string::strcpy(char* source, char* from)
{
}
void string::strcat(char* source, char* from)
{
}
int string::strlen(char* source)
{
return (0);
}
</pre>
<br><br>
A namespace can contain functions, variables,<br> and classes. When you wish to use<br> a namespace you can use the statement,<br> using namespace name; to allow the<br> aspects of that namespace to be accessed<br> without specificly specifying there namespace.<br> 
</FONT>
</HTML>
Originele reacties (3)
Hersteld van de Wayback Machine