Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Home » Tip Bank » C++
Language: C++
Expertise: Advanced
Feb 26, 1998

Namespaces are open

Unlike structs, classes, enums, and unions, the enclosing brace of a namespace definition does not prohibit you from further extensions to that namespace. A namespace can be extended this way:
 //file proj_classes.h

namespace MyProj {
	class RealTimeEncoder{
			//../};

	class NetworkLink {
			//...
			};

	class UserInterface {
			//...
			};
};

//file proj_const.h
namespace MyProj { //now extending MyProj namespace
	enum NetProtocols {
		TCP_IP,
		HTTP,
		X25,
		//...
		};

//...further declarations
};

//file app.cpp

#include 
Danny Kalev
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date