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

Question Tag Definition in english with examples upsc ssc ias state pcs exames important topic

Question Tag Definition • A question tag is a small question at the end of a…

3 weeks ago

Translation in english grammer in hindi examples Step of Translation (अनुवाद के चरण)

Translation 1. Step of Translation (अनुवाद के चरण) • मूल वाक्य का पता करना और उसकी…

3 weeks ago

Report Writing examples in english grammer How to Write Reports explain Exercise

Report Writing • How to Write Reports • Just as no definite rules can be laid down…

3 weeks ago

Letter writing ,types and their examples in english grammer upsc state pcs class 12 10th

Letter writing • Introduction • Letter writing is an intricate task as it demands meticulous attention, still…

3 weeks ago

विश्व के महाद्वीप की भौगोलिक विशेषताएँ continents of the world and their countries in hindi features

continents of the world and their countries in hindi features विश्व के महाद्वीप की भौगोलिक…

3 weeks ago

भारत के वन्य जीव राष्ट्रीय उद्यान list in hin hindi IAS UPSC

भारत के वन्य जीव भारत में जलवायु की दृष्टि से काफी विविधता पाई जाती है,…

3 weeks 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