Static member function in C++ in Hindi

हेलो स्टूडेंट्स, इस पोस्ट में हम आज Static member function in C++ in Hindi के बारे में पढ़ेंगे | इंटरनेट में C++ भाषा के नोट्स हिंदी में बहुत कम उपलब्ध है, लेकिन हम आपके लिए यह हिंदी में डिटेल्स नोट्स लाये है, जिससे आपको यह टॉपिक बहुत अच्छे से समझ आ जायेगा |

हेल्लो दोस्तों! आज हम इस post में Static member function in C++ in Hindi (स्थैतिक मेम्बर फंक्शन क्या है?) के बारें में पढेंगे और इसके example को भी देखेंगे. तो चलिए start करते हैं:-

Static member function in C++ in Hindi

Static member function को create करने के लिए हमें function को declare करते समय static कीवर्ड का प्रयोग करना पड़ता है.

जब भी किसी member function को static के रूप में declare किया जाता है तो वह class के objects पर depend (निर्भर) नहीं होता.

हम एक static member function को object और dot operator (.) का प्रयोग करके invoke कर सकते हैं परन्तु हमें static members को invoke करने के लिए class name और scope resolution operator : : का प्रयोग करना चाहिए.

static member functions केवल static data members और दूसरे static member functions को access कर सकते हैं. ये class के non-static data members और member functions को एक्सेस नहीं कर सकते.

Drawbacks of static member functions  – इसकी कमियाँ

  • इनके पास this pointer नहीं होता है.
  • static member function जो है वह virtual नहीं हो सकता.

Static member function का example –

#include <iostream>
using namespace std;
class S
{
static int i;
public:
static void init(int x)
{
i = x;
}
void show()
{
cout <<i;
}
};

int S::i;
int main()
{
S::init(150); 
S x;
x.show();
return 0;
}

इसका आउटपुट –
150

references;- https://www.tutorialspoint.com/cplusplus/cpp_static_members.htm

static member function in c++ in hindi

हम आशा करते है कि यह Static member function in C++ in Hindi के हिंदी में नोट्स आपकी स्टडी में उपयोगी साबित हुए होंगे | अगर आप लोगो को इससे रिलेटेड कोई भी किसी भी प्रकार का डॉउट हो तो कमेंट बॉक्स में कमेंट करके पूंछ सकते है | आप इन्हे अपने Classmates & Friends के साथ शेयर करे |

Leave a Comment

Your email address will not be published. Required fields are marked *