#include <iostream>
using namespace std;
class B {
public:
B() { cout << "98 "; }
virtual ~B() { cout << "56 "; } // Don't Edit or Modify the "cout"
}; // End of class B
class D : public B {
int n;
public:
D(int p):n(p) { cout << n << " "; }
~D() { cout << n*2 << " "; }
}; // End of class D
int main() {
int n ; cin >> n ;
B *basePtr = new D(n);
delete basePtr;
return 0;
}
using namespace std;
class B {
public:
B() { cout << "98 "; }
virtual ~B() { cout << "56 "; } // Don't Edit or Modify the "cout"
}; // End of class B
class D : public B {
int n;
public:
D(int p):n(p) { cout << n << " "; }
~D() { cout << n*2 << " "; }
}; // End of class D
int main() {
int n ; cin >> n ;
B *basePtr = new D(n);
delete basePtr;
return 0;
}
No comments:
Post a Comment