JOIN us on
WhatsApp Group Join Now
Telegram Join Join Now

हिंदी माध्यम नोट्स

Categories: c++ language in hindi

UNNAMED NAMESPACE AND FUTURE in c++ language in hindi explanation program example source code

in hindi explanation program example source code , UNNAMED NAMESPACE AND FUTURE in c++ language :-
इससे पहले article मे , namespace को discuss किया है | अब इस article मे unnamed namespace और इसके attributes को discuss करेगे |
namespace std ::
हमने इससे पहले कई उदाहरन मे namespace std को use किया है | लेकिन अभी तक इसे discuss नहीं किया है अब इस article मे इसे discuss करेगे | इसका syntax निन्म होता है :
#include<iostream.h>
{
using namespace std;
}
इस syntax से यह declare होता है की iostream header मे declare की सभी statement namespace std मे रखा जाता है | और using directive method से इस namespace को main() function मे access किया जा सकता है | इसका उदाहरन निन्म है :
#include<iostream>
#include<conio>
using namespace std;
void main()
{
cout<<“Good Morning !I am hard ware 123121. “;
}
इस उदहारण मे using directive method से std को add किया जाता है | इस syntax से  namespace std से सभी name को namespace global मे shift किया जकता है | अगर सिस्टम मे namespace std नहीं है तब in दोनों  syntax को निन्म स्य्नब्ताक्स से replace किया जा सकता है | और
#include<iostream.h>
#include<conio>
void main()
{
cout<<“Good Morning !I am hard ware 123121. “;
}
किसी प्रोग्राम मे , using namespace std; को कम कम से use करना चाहिए क्योकि इससे प्रोग्राम मे complexity बढती है | क्योकि using स्त्स्तेमेंट scope resolution प्रॉब्लम को generate करते है |
इसके स्थान पर निन्म syntax को use किया जा सकता है :
int a;
std::cout<<“value : “<<endl;
std :: cin>>a;
std::cout<<“your enter “<<a;
या इसके अलावा निन्म syntax को use किया जा सकता है :
using std::cout;
using std::cin ;
using std::endl;
cout<<“value : “<<endl;
cin>>a;
cout<<“your enter “<<a;
Unnamed namespace
जब किसिस namespace को बिना name के declare करते है उसे unnamed namespace कहते है | उदाहरन के लिए :
namespace
{
int cat;
int dog;
}
इस प्रकार के namespace को use करने के लिए using directive method को use किया जाता है | इस namespace मे declare name का scope जब तक  active रहता है तब तक declartive region का end नहीं होता है और इस region मे unnamed namespace को declare किया जाता है |
जब  unnamed namespace को use किया जता है using directive और using declartion को use किया जा सकता है |
किसी unnamed namespace के name को एक या एक से अधिक file मे declare नहीं किया जा सकता है | चाहे दोनों file मे namespace को declare किया गया है |
इसे use कर्ण एके लिए static variable को use किया जाता है जिस्म इंटरनल linking होता है | C++ standard मे  किसी namespace मे  static  और  global keyword को बहुत कम ही use किया जाता है |
उदहारण के लिए :
static int count ;
int other();
void main()
{
…….;
…….;
}
int other ()
{
…….;
…….;
}
इस syntax को namespace से execute किया जाता है तब
name
{
int count ;
}
void main()
{
…….;
…….;
}
int other ()
{
…….;
…….;
}
Namespace or future
जब namespace को प्रोग्राम मे add किया गया तब programming स्टाइल मे निन्म future enhancement हुए |
1.किसी global variable के स्थान पर   namespace के names को use किया जाता है |
2.static global variable के स्थान पर unnamed namespace के name को use किया जाता है |
3.जब दो या दो से अधिक function या class की library को develop किया जाता है तब इन्हें namespace मे रखा जाता है | c++ मे तो std library को namespace को use करने ही call किया जाता है |
जब math.h को use किया जाता है तब namespace को use नहीं करना चाहिए | लेकिन जब cmath को use किया जाता है तब इसे namespace मे std के तरह call किया जा सकता है |
4.using directive को केवल old code को namespace मे convert करने के लिए किया जाता है |
5.header file को call करने के लिए using को use नहीं करना चाहिए | क्योकि using method से केवल name को access किया जा सकता है function को नहीं | लेकिन जब कभी header file को using के साथ use करना हो तो तब इसे #INCLUDE  के बाद declare करना चाहिए |
6.किसी namespace के name सको access करने के लिए scope resolution और using declaration को use किया जाता है  |
7.using declaration मे global scope के बजाय local scope को use करना चाहिए |
Namespace का use किसी बहुत बड़े programming प्रोजेक्ट को handle करने मे किया जाता है |
Namespace Summery
c++ मे multiple file मे programming को develop किया जाता है | इसके लिए header file को use करना चाहिए | जिससे multiple file के content को एक main प्रोग्राम मे use किया जा सकते है |source file को function file से अलग declare करना चाहिए | header file और source file मे यूजर define function को use करते हुए प्रोग्राम task को perform करता है |
इसके अलावा namespace को किसी large प्रोग्राम मे name conflict को दूर करने के लिए किया जाता है | namespace से किसी name का region और identifier को declare किया जाता है | और using method या scope resolution operator से in namespace को use किया जासकता है |
इस article मे namespace को declare किया है अब आगे के article मे namespace के उदाहरनो को discuss करेगे |
Sbistudy

Recent Posts

सती रासो किसकी रचना है , sati raso ke rachnakar kaun hai in hindi , सती रासो के लेखक कौन है

सती रासो के लेखक कौन है सती रासो किसकी रचना है , sati raso ke…

18 hours ago

मारवाड़ रा परगना री विगत किसकी रचना है , marwar ra pargana ri vigat ke lekhak kaun the

marwar ra pargana ri vigat ke lekhak kaun the मारवाड़ रा परगना री विगत किसकी…

18 hours ago

राजस्थान के इतिहास के पुरातात्विक स्रोतों की विवेचना कीजिए sources of rajasthan history in hindi

sources of rajasthan history in hindi राजस्थान के इतिहास के पुरातात्विक स्रोतों की विवेचना कीजिए…

2 days ago

गुर्जरात्रा प्रदेश राजस्थान कौनसा है , किसे कहते है ? gurjaratra pradesh in rajasthan in hindi

gurjaratra pradesh in rajasthan in hindi गुर्जरात्रा प्रदेश राजस्थान कौनसा है , किसे कहते है…

2 days ago

Weston Standard Cell in hindi वेस्टन मानक सेल क्या है इससे सेल विभव (वि.वा.बल) का मापन

वेस्टन मानक सेल क्या है इससे सेल विभव (वि.वा.बल) का मापन Weston Standard Cell in…

3 months ago

polity notes pdf in hindi for upsc prelims and mains exam , SSC , RAS political science hindi medium handwritten

get all types and chapters polity notes pdf in hindi for upsc , SSC ,…

3 months ago
All Rights ReservedView Non-AMP Version
X

Headline

You can control the ways in which we improve and personalize your experience. Please choose whether you wish to allow the following:

Privacy Settings
JOIN us on
WhatsApp Group Join Now
Telegram Join Join Now