#include <iostream>
class A {
int a,b;
public:
A () : a(0), b(0) {
std::cout << "A()" << std::endl;
}
A (int x, int y) : a(x), b(y) {
std::cout << "A(" << x << ',' << y << ')' << std::endl;
}
A (const A& orig) {
a = orig.a;
b = orig.b;
std::cout << "A(copy)" << std::endl;
}
friend std::ostream &operator <<(std::ostream &oss, const A &obj);
~A() {
std::cout << "~A()" << std::endl;
}
};
std::ostream &operator <<(std::ostream &oss, const A &obj)
{
oss << '(' << obj.a << ',' << obj.b << ')';
return oss;
}
int main () {
A *mas = new A[10];
std::fill(mas, mas+10, A(1,5));
for (size_t i = 0; i < 10; ++i)
std::cout << mas[i];
std::cout << std::endl;
delete [] mas;
return 0;
}