#include <vector>
#include <iostream>
using namespace std;
class A {
private:
int nId;
public:
A(intn) {
nId= n;
cout<< nId << " contructor" << endl;
};
A(const A & a ) {
nId= a.nId ;
cout<< nId << " copy constructor" << endl;
}
~A() {
cout<< nId << " destructor" << endl;
}
};
int main()
{
vector<A*>vp;
vp.push_back(newA(1));
vp.push_back(newA(2));
vector<A>v;
v.push_back(3);
return 0;
}
#include <iostream>
using namespace std;
class A {
private:
int nId;
public:
A(intn) {
nId= n;
cout<< nId << " contructor" << endl;
};
A(const A & a ) {
nId= a.nId ;
cout<< nId << " copy constructor" << endl;
}
~A() {
cout<< nId << " destructor" << endl;
}
};
int main()
{
vector<A*>vp;
vp.push_back(newA(1));
vp.push_back(newA(2));
vector<A>v;
v.push_back(3);
return 0;
}