Topic: Borland C++
Author: s9100767@cumulus.csd.unsw.OZ.AU (Vladimir Gilbourd)
Date: Wed, 13 Oct 1993 07:10:11 GMT Raw View
Compile, please, and run two simple patterns. ( Definitions of classes are
equal for both cases). As you will see the output will be different. I compiled
this patterns with four other compilers ( Microsoft 7 and 3 different UNIX-
based C++ compilers) - the output is equal in both patterns as it should be.
Who can explain why Borland gives different outputs?
My e-mail address: vladgil@research.petrol.unsw.edu.au
Thanks in advance
V. Gilbourd
*******************************************
#include <iostream.h>
class base
{ public:
base() {cout<<"base-const ";}
virtual ~base() {cout<<"base-destr ";}
};
class son : public base
{ public:
son() {cout<<"son-const ";}
~son() {cout<<"son-destr ";}
};
****************************************
Pattern 1 * Pattern 2
main() * main()
{ cout<<endl; * { cout<<endl;
base *pp; * base *pp;
pp = new son[1]; * pp = new son;
delete [] pp; * delete pp;
} * }
****************************************
Author: s9100767@cumulus.csd.unsw.OZ.AU (Vladimir Gilbourd)
Date: Wed, 13 Oct 1993 07:16:58 GMT Raw View
Compile, please, and run two simple patterns. ( Definitions of classes are
equal for both cases). As you will see the output will be different. I compiled
this patterns with four other compilers ( Microsoft 7 and 3 different UNIX-
based C++ compilers) - the output is equal in both patterns as it should be.
Who can explain why Borland gives different outputs?
My e-mail address: vladgil@research.petrol.unsw.edu.au
Thanks in advance
V. Gilbourd
*******************************************
#include <iostream.h>
class base
{ public:
base() {cout<<"base-const ";}
virtual ~base() {cout<<"base-destr ";}
};
class son : public base
{ public:
son() {cout<<"son-const ";}
~son() {cout<<"son-destr ";}
};
****************************************
Pattern 1 * Pattern 2
main() * main()
{ cout<<endl; * { cout<<endl;
base *pp; * base *pp;
pp = new son[1]; * pp = new son;
delete [] pp; * delete pp;
} * }
****************************************