In C++, in the definition of functions, the argument identifiers are optional. In which scenario this feature could be useful? -


  int foo (int) {...}  

कोई भी विचार ?

एक मामले में जहां आप एक फ़ंक्शन परिभाषित करते हैं लेकिन पैरामीटर का नाम नहीं देते स्कॉट मेयेर्स "प्रभावी सी ++, तीसरा संस्करण ", आइटम 47:

  टेम्पलेट & lt; typename IterT, typename डीटीटी & gt; शून्य doAdvance (IterT और iter, जिला डी, std :: random_access_iterator_tag) {iter + = डी; }  

इन्हें प्रयोग किया जाता है:

  टेम्पलेट & lt; typename IterT, typename DistT & gt; शून्य अग्रिम (आईटरटी एंड इटर, डीसीटी डी) {डैववेनेंस (आईटर, डी, टाइपनाम स्टडी :: इटरेटर_ट्रेट & lt; IterT & gt; :: इटरेटर_कैचर ()); }  

अनिवार्य रूप से, doAdvance में तीसरा पैरामीटर एक चर नाम से एक समान नहीं है, यानी यह एक अनाम पैरामीटर है एक अज्ञात पैरामीटर होने की कोई समस्या नहीं है, क्योंकि यह तर्क केवल उस संकल्प के दौरान उपयोग किया जाता है जो उपयोग करने के लिए अतिभारित फ़ंक्शन है। मैं संबंधित विषयों में इन विषयों पर चर्चा करता हूं।


Comments

Popular posts from this blog

paypal - How to know the URL referrer in PHP? -

oauth - Facebook OAuth2 Logout does not remove fb_ cookie -

wpf - Line breaks and indenting for the XAML of a saved FlowDocument? -