devxlogo

Namespaces are open

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.hnamespace MyProj {	class RealTimeEncoder{			//../};	class NetworkLink {			//...			};	class UserInterface {			//...			};};//file proj_const.hnamespace MyProj { //now extending MyProj namespace	enum NetProtocols {		TCP_IP,		HTTP,		X25,		//...		};//...further declarations};//file app.cpp#include

devx-admin

Share the Post: