+ Reply to Thread
Results 1 to 2 of 2

Thread: What is namespace alias?

  1. #1
    Junior Member
    Join Date
    Feb 2012
    Posts
    48

    What is namespace alias?

    What is namespace alias?

    How to use it?

    Please provide me some example.

  2. #2
    Following is example of namespace alias:

    Code:
    namespace N1
    {
    	namespace N2
    	{
    		class CBar
    		{
    		public:
    			void DoMessage()
    			{
    				OutputDebugString("N1::N2::CBar::DoMessage") ;
    			}
    		} ;
    	} ;
    
    } ;
    
    void UseNamesapce()
    {
    	N1::N2::CBar objBar ;
    
    	objBar.DoMessage() ;
    
    	//namespace alias
    	namespace myBar = N1::N2 ;
    
    	myBar::CBar objBar2 ;
    	objBar2.DoMessage() ;
    }
    Hope this helps.

+ Reply to Thread

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts