Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- using namespace std;
- class X
- {
- public:
- int i;
- X();
- ~X();
- };
- X::X()
- {
- i = 1;
- cout << "---constructor" << '\n';
- }
- X::~X()
- {
- cout << "***desctructor" << '\n';
- }
- int main()
- {
- vector<X> *vx = new vector<X>;
- cout << "------------------------------------" << endl;
- vx->push_back(X());
- vx->push_back(X());
- vx->push_back(X());
- vx->push_back(X());
- vx->push_back(X());
- cout << "------------------------------------" << endl;
- delete vx;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement