JOIN us on
WhatsApp Group Join Now
Telegram Join Join Now

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

Class 6

Hindi social science science maths English

Class 7

Hindi social science science maths English

Class 8

Hindi social science science maths English

Class 9

Hindi social science science Maths English

Class 10

Hindi Social science science Maths English

Class 11

Hindi sociology physics physical education maths english economics geography History

chemistry business studies biology accountancy political science

Class 12

Hindi physics physical education maths english economics

chemistry business studies biology accountancy Political science History sociology

Home science Geography

English medium Notes

Class 6

Hindi social science science maths English

Class 7

Hindi social science science maths English

Class 8

Hindi social science science maths English

Class 9

Hindi social science science Maths English

Class 10

Hindi Social science science Maths English

Class 11

Hindi physics physical education maths entrepreneurship english economics

chemistry business studies biology accountancy

Class 12

Hindi physics physical education maths entrepreneurship english economics

chemistry business studies biology accountancy

Categories: c++ language in hindi

const member function c++ in hindi , what is constant member function in c++ language

what is constant member function in c++ language , const member function c++ in hindi :-
इससे पहले के article मे const के basic को discuss किया तह अब इस article मे const के बारे और कुछ पॉइंट्स को discuss करेगा |
c++ मे , const keyword का use किसी storage को alter करने के लिए किया जाता है |जहा पर global variable का linking external होता है लेकिन const global variable का linking internal होता है |  c++ मे जिस पारकर static specifier को use किया जाता है उसी प्रकार global const variable को use किया जाता है |
उदाहरन के लिए
#include<iostream.h>
#include<conio>h>
const int a= 16;
int main() {
cout<<“data : “<<a;
getch();
}
इस उदाहरन मे , a एक global const variable है जिसकी value 16 है ये variable एक static variable की तरह कार्य करता है | इसके value पुरे प्रोग्राम मे constant होता है |
c++ constant variable की value को change करने के लिए simple method होती है | उद्धरण के लिए अगर किसी constant value को header file मे declare किया जाता है | इसे कही जगह use किया जा सकता है |  लेकिन इस header file को preprocessor के बाद include किया जाता है | तभी इसे variable को use किया जा सकता है |सभी सौद्र्स file मे global variable को define किया जाता है  |
const int a= 10 ;
const char * name = ” parth “;
अगर global variable को  रेगुलर variable से external linkage होता है | लेकिन इसमें error होता है | जब किसी global variable को एक file मे define किया जाता है  तब केवल इस file मे ही global variable को use किया जाता है | लेकिन किसी दूसरी file मे , इस variable को use करने के लिए extern keyword को use किया जाता है |
इसका उदाहरन है ;
file 1 मे
const int a= 1;
char char * name = parth;
file 2 मे ,
#include<iostream.h>
#include<conio>h>
#include file1 ;
int main() {
cout<<“data : “<<a;
cout<<“name :”<<*name ;
cout<<“Adddress :”<<&name ;
getch();
}
उपर दिए गये उदाहरनो मे ग्लोबल variable को file 2 मे use किया जाता है | इसमें error आता है | क्योकि file 1 और file 2 मे const variable को access नहीं किया जा सकता है |
इसके लिए extern को use किया जाता है |
file 1 मे
extern const int a= 1;
extern char char * name = parth;
file 2 मे ,
#include<iostream.h>
#include<conio>h>
#include file1 ;
int main() {
cout<<“data : “<<a;
cout<<“name :”<<*name ;
cout<<“Adddress :”<<&name ;
getch();
}
इस उदाहरनो मे const variable को external linking को बनाया गया है इसके लिए extern keyword को use किया जाता है | external linking के द्वारा इन variable  को file 2 मे  use किक्या जा सकता है |
variable मे linking को बजाय जाता है | इसके अलावा function के साथ linking को use किया जा सकता है |
Function linking
c++ मे , एक function के अन्दर दुसरे function को define नहीं किया जा सकता है | in function का scope static storage होता है इन function का life cycle जब तक होता है तब प्रोग्राम की running होगा | जब किसी function को किसी दुसरे function के अन्दर को define किया जाता है तब in function को extern keyword के अथ define किया जाता है | लेकिन यव ऑप्शनल है |
static keyword से function का scope static होता है | इसका linking इंटरनल होता है |
इसका उदाहरन होता है :
#include<iostream.h>
#include<conio>h>
static void add(int , int );
int main() {
int a, b;
cout<<“Enter values :”<<endl;
cin>>a>>b;
add(a,b);
getch();
}
static void add(int e , int f)
{
int c= e+f;
cout<<“Output :”<<c;
}
इस उदहारण मे , function केवल इस file मे use हो सकता है | लेकिन जब किसी function को external के साथ define किया जाता है तब इस function को किसी file मे
c++ मे , const keyword का use किसी memory location को  fixed करने के लिए किया जाता है |जहा पर function का linking external होता है लेकिन const global function  का linking internal होता है |
उदाहरन के लिए
#include<iostream.h>
#include<conio>h>
const print(char a);
int main() {
cout<<“data : “<<a;
getch();
}
इस उदाहरन मे , print एक global const function  है जिसमे line को print किया जाता  है ये function एक static function की तरह कार्य करता है | इसके value पुरे प्रोग्राम मे use किया जा सकता  है |
c++ constant function  की scope को change करने के लिए linking को change किया जाता है  | उदाहरन  के लिए अगर किसी function  को header file मे declare किया जाता है | इसे कही जगह use किया जा सकता है |  लेकिन इस header file को pre processor के बाद include किया जाता है | तभी इसे function  को use किया जा सकता है |
int add(int , int );
int check( int number );
अगर global function को  रेगुलर function  से external linkage होता है | लेकिन इसमें error होता है | जब किसी global function  को एक file मे define किया जाता है  तब केवल इस file मे ही global function  को use किया जाता है | लेकिन किसी दूसरी file मे , इस function  को use करने के लिए extern keyword को use किया जाता है |
इस article मे , const  को discuss किया है अब आगे के article मे c++ के कुछ और advance topic को discuss करेगे |
Sbistudy

Recent Posts

द्वितीय कोटि के अवकल समीकरण तथा विशिष्ट फलन क्या हैं differential equations of second order and special functions in hindi

अध्याय - द्वितीय कोटि के अवकल समीकरण तथा विशिष्ट फलन (Differential Equations of Second Order…

7 hours ago

four potential in hindi 4-potential electrodynamics चतुर्विम विभव किसे कहते हैं

चतुर्विम विभव (Four-Potential) हम जानते हैं कि एक निर्देश तंत्र में विद्युत क्षेत्र इसके सापेक्ष…

3 days ago

Relativistic Electrodynamics in hindi आपेक्षिकीय विद्युतगतिकी नोट्स क्या है परिभाषा

आपेक्षिकीय विद्युतगतिकी नोट्स क्या है परिभाषा Relativistic Electrodynamics in hindi ? अध्याय : आपेक्षिकीय विद्युतगतिकी…

5 days ago

pair production in hindi formula definition युग्म उत्पादन किसे कहते हैं परिभाषा सूत्र क्या है लिखिए

युग्म उत्पादन किसे कहते हैं परिभाषा सूत्र क्या है लिखिए pair production in hindi formula…

1 week ago

THRESHOLD REACTION ENERGY in hindi देहली अभिक्रिया ऊर्जा किसे कहते हैं सूत्र क्या है परिभाषा

देहली अभिक्रिया ऊर्जा किसे कहते हैं सूत्र क्या है परिभाषा THRESHOLD REACTION ENERGY in hindi…

1 week 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