मैं निम्नलिखित स्रोतएक int * NULL का डिफ़ॉल्ट मान है?
#include <iostream>
using namespace std;
template <class T>
class AAA
{
public:
void f() { cout << T() << " "; }
};
int main (void)
{
AAA<int*> a;
AAA<int> b;
a.f(); /// in this case, T() == NULL??
b.f();
return 0;
}
लिखा है और सांत्वना प्रिंट है 00000000 0.
अगर टी, int * है टी() == NULL (विजुअल स्टूडियो 2010 में)? और क्या यह हमेशा सच है?
हाँ। हमेशा। http://stackoverflow.com/a/937257/707111 – Ryan
संभावित डुप्लिकेट [सी ++ पॉइंटर के लिए डिफ़ॉल्ट कन्स्ट्रक्टर क्या है?] (http://stackoverflow.com/questions/936999/what-is-the-default-constructor -for-c-pointer) – Troubadour