delorie.com/archives/browse.cgi | search |
Message-ID: | <003201c13a3f$053b2f40$aa7ba8c0@fuego> |
From: | "Gorden" <gorden AT ms9 DOT url DOT com DOT tw> |
To: | <djgpp AT delorie DOT com> |
References: | <Pine DOT SUN DOT 3 DOT 91 DOT 1010910090923 DOT 18194E-100000 AT is> |
Subject: | Can You help me about djgpp with c++ |
Date: | Tue, 11 Sep 2001 05:24:47 +0800 |
MIME-Version: | 1.0 |
X-Priority: | 3 |
X-MSMail-Priority: | Normal |
X-Mailer: | Microsoft Outlook Express 5.50.4522.1200 |
X-MimeOLE: | Produced By Microsoft MimeOLE V5.50.4522.1200 |
Reply-To: | djgpp AT delorie DOT com |
I Buy a book (Teach Yourself C++, 3rd Edition By Herbert Schildt) inside have a C++ smaple #include <iostream.h> #include <conio.h> class samp { private: int i; public: samp(void) { cout << "constructor" << '\n'; } ~samp(void) { cout << "destructor " << '\n'; } void set(int n) { i = n ; } int get(void ) { return i; } }; int test(samp o) { return o.get() * o.get(); } void main(void) { clrscr(); samp o; o.set(10); cout << test(o) << '\n'; } The Book have result is constructor destructor 100 destructor in borland c++ 3.01 the result is constructor destructor 100 destructor But in djgpp the result is constructor destructor 100 destructor destructor Why in djgpp 3 times call destructor, I try compile on borland C++ 3.01 have 2 times call destructor Is djgpp or gpp error ??????????
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |