C++ namespace Creating

Description

C++ namespace Creating

#include <iostream> 
  
namespace Player 
{ 
        void PrintName() 
        { //  ww  w.j av a  2 s  .c o m
                std::cout << "My name is Bruce!" << endl; 
        } 
} 
  
namespace Vehicle 
{ 
        void PrintName() 
        { 
                std::cout << "I am a car!" << endl; 
        } 
} 
  
using namespace Player; 
  
int main(int argc, char *argv [])
{ 
        PrintName(); 
  
        Vehicle::PrintName(); 
  
        return 0; 
}



PreviousNext

Related