Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Solution file */
- class Test {
- public:
- Test(int n) : n(n) {}
- ~Test() {
- print();
- }
- void print() {
- cout << n << endl;
- }
- private:
- int n;
- };
- void solve(istream& in, ostream& out) {
- Test a(1000);
- }
- /* Submission.cpp: no method "Test::print()" that is called from destructor (destructor is not called explicitly, only by default on exit from function solve() ) */
- class Test {
- public:
- Test(int n) : n(n) {}
- ~Test() {
- print();
- }
- private:
- int n;
- };
- void solve(istream& in, ostream& out) {
- Test a(1000);
- }
- /* **************************** */
- /* Solution file */
- class Test {
- public:
- Test(int n) : n(n) {}
- ~Test() {
- print();
- }
- void print() {
- cout << n << endl;
- }
- private:
- int n;
- };
- void solve(istream& in, ostream& out) {
- Test * a = new Test(1000);
- delete a;
- }
- /* Submission.cpp: no method "Test::print()" that is called from destructor (destructor is called implicitly by operator delete ) */
- class Test {
- public:
- Test(int n) : n(n) {}
- ~Test() {
- print();
- }
- private:
- int n;
- };
- void solve(istream& in, ostream& out) {
- Test * a = new Test(1000);
- delete a;
- }
- /* **************************** */
- /* Solution file */
- class Test {
- public:
- Test(int n) : n(n) {}
- ~Test() {
- print();
- }
- void print() {
- cout << n << endl;
- }
- private:
- int n;
- };
- void solve(istream& in, ostream& out) {
- Test a(1000);
- a.~Test();
- }
- /* Submission.cpp: works fine (destructor is called explicitly by a.~Test() ) */
- class Test {
- public:
- Test(int n) : n(n) {}
- ~Test() {
- print();
- }
- void print() {
- cout << n << endl;
- }
- private:
- int n;
- };
- void solve(istream& in, ostream& out) {
- Test a(1000);
- a.~Test();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement