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

Share it Please
asad

About Author!

Asad Niazi is Software Engineer , Programmer, Web Developers and a young mentor of Tech Solutions Desk and Blogging Solutions . Asad Love to writes about Technology, Programming, Blogging and make money online.

2 comments: Post Yours! Read Comment Policy!▼
Important Note:
We have Zero Tolerance to Spam. Chessy Comments and Comments with Links will be deleted immediately upon our review.

  1. This site is full of 'great' {tab} {tab} {tab} programming. There, perfect spacing (on my screen anyway).
    Heh. All the good languages have string formatting/padding. I remember some of my first programs looking like that, but nowadays it is inexcusable. Not to mention the weird use of namespaces for no real reason.

    ReplyDelete
  2. The page crashed for me on android with the cpu getting hot. Seems legit.

    ReplyDelete