class point
{
int x,y;
public:
point (void);//constructor declared
..........
..........
};
point::point (void)//constructor defined
{
x = 0;
y = 0;
}
जब हम क्लास point के ऑब्जेक्ट को घोषित करते हैं
उदाहरण के लिए-
point p;
क्लास के अन्दर कंस्ट्रक्टर स्वतः ही कॉल हो जाता है और प्राईवेट डेटा मेंम्बर x और y को शून्य से ऑब्जेक्ट p के लिए इनिशियलाइज कर देते हैं। जो कंस्ट्रक्टर आरग्यूमेन्ट नहीं लेते हैं उसे डिफॉल्ट कंस्ट्रक्टर कहा जाता है। अगर ऐसा कोई कंस्ट्रक्टर क्लास में परिभाषित नहीं है तब कम्पाइलर डिफॉल्ट कंस्ट्रक्टर उपलब्ध करवाता है उस क्लास के ऑब्जेक्ट घोषित करने के लिए।