#include <iostream>
#include <vector>
#include <cstring>
using namespace std;

class A
{
public:
    A(const char *str)
    {
        cptr = new char [strlen(str)];
        strcpy(cptr,str);
        cout<<"A(const char *str) called and cptr is "<<cptr<<endl;
    }
    A(const A &a)
    {
        cptr = new char [strlen(a.cptr)+1];
        strcpy(this->cptr,a.cptr);
        cptr[strlen(a.cptr)] = '$';
        cptr[strlen(a.cptr)+1] = '\0';
        cout<<"A(const A &a) called and cptr is "<<cptr<<endl;
    }
    ~A()
    {
        cout<<"~A() called and cptr is "<<cptr<<endl;
        delete [] cptr;
    }
private:
    char *cptr;
};


int main()
{
    A a1("1"),a2("2"),a3("3");
    vector<A> Avec;
    Avec.reserve(256);

    Avec.push_back(a1);
    Avec.push_back(a2);
    Avec.push_back(a3);
}