#include <iostream>
#include <initializer_list>

class arr1D
{
protected:
	int size;
	int *arr;
public:
	arr1D(const std::initializer_list<int>& input) : size(input.size())
	{
		int* temp = new int[size];
		int index = 0;
		for (const auto& it : input)
		{
			temp[index] = it;
			++index;
		}
		arr = temp;
	}

	arr1D(int siz = 10) :size(siz), arr(new int[size] {0})  // this will also do the same job
		{}
	~arr1D()                          //check rule of 3:  also need operator= and copy assignment con.
	{
		delete arr;
	}
	friend std::ostream & operator<<(std::ostream &, const arr1D &);
};
int main()
{
	arr1D a1 = { 1,2,3,4,5 };
	std::cout << a1 << std::endl;

	arr1D a2;
	std::cout << a2 << std::endl;

	std::cin.get();
}
std::ostream & operator<<(std::ostream &_return, const arr1D &a)
{
	_return << "arr: ";
	for (int i = 0; i<a.size; i++)
	{
		std::cout << *(a.arr + i) << " ";
	}
	_return << "size: " << a.size;
	return _return;
}

