Showing posts with label How to use namespace on functions. Show all posts
Showing posts with label How to use namespace on functions. Show all posts

Monday, 18 August 2014

Namespace in c++ Program

Structure of the Problem Requirements 

In this problem we will learn how to use namespace function on different functions and classes. Namespace is a function which is used to differentiate between two functions or classes who has function with the same name.  Namespace start with keyword "namespace" just like class keyword . After this we give namespace a name and define it scope . whenever we want to access a desire functions (same name) we just reference it namespace and then give the function name. Here is the source code of this problem which help you in better understanding .

Source Code  

#include<iostream>
using namespace std;
 namespace  st_namespace
 {
  void LEP ()
  {
  cout<<" LEP Provide you world best platform to learn Programming. You Can Visit us at \n \n ";
  }
 }
  namespace  nd_namespace
 {
  void LEP ()
  {
  cout<<" \t \t \t www.ancodingpoint.com \n";
  }
 
 }
 int main ()
 {
  st_namespace::LEP();
  nd_namespace::LEP();
 }

output of the program

C++ Prgramming
NameSpace Data Type