| | Submitted on: 5/26/2002 5:18:43 PM
By: Jared Bruni
Level: Intermediate User Rating:
By 11 Users Compatibility:C++ (general), Microsoft Visual C++, Borland C++, UNIX C++
Users have accessed this article 961 times. | (About the author) |
| | Explains namespaces. | |
|
Terms of Agreement:
By using this article, you agree to the following terms...
1) You may use
this article in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
2) You MAY NOT redistribute this article (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.
3) You may link to this article from another website, but ONLY if it is not wrapped in a frame.
4) You will abide by any additional copyright restrictions which the author may have placed in the article or article's description. |
Namespace tutorial
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.
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);
}
A namespace can contain functions, variables, and classes. When you wish to use a namespace you can use the statement, using namespace name; to allow the aspects of that namespace to be accessed without specificly specifying there namespace.
| |
Other 273 submission(s) by this author
|
|
|
Report Bad Submission |
|
|
Your Vote! |
See Voting Log |
|
Other User Comments |
5/27/2002 12:33:51 PM:Merlin Corey Heh, I did something simalar... Your
tutorial is cut off - it seems to end
at "A namespace can contain functions,
variables, and cla"...
|
5/27/2002 12:34:51 PM:Merlin Corey *similar* ;)
|
5/27/2002 5:53:05 PM:Jared Bruni ok *fixed* it
|
5/27/2002 6:48:59 PM:Jimmy Murphy hey you seem to know alot and be good
at C++...how much money do you make a
year?
|
5/27/2002 8:20:53 PM:David Fritts Jared, got aim? Message me if you do or
go download it then message me:
Nulled0x00 is my s/n i got some
questions to ask you ;p
|
5/27/2002 9:49:29 PM:Jared Bruni my screen name is xmasterxx3 on aim
|
5/28/2002 12:53:09 AM:TRON Nice article, I've learned something
from this at least =)
|
7/21/2002 2:19:36 AM:Alok Gupta good work sir pls eamil me,u are
great,and talking to great people is
cooll
|
|
Add Your Feedback! |
Note:Not only will your feedback be posted, but an email will be sent to the code's author in your name.
NOTICE: The author of this article has been kind enough to share it with you. If you have a criticism, please state it politely or it will be deleted.
For feedback not related to this particular article, please click here. |
|