Пример #1
0
void TestStack()
{	
	//MyType t(10);
	//CopyOrNot(t);

	//MyType t2(20);
	//CopyOrNot2(t2);
	
	class MyType
	{
	public:
		MyType(int v) : value(v) {}
		MyType(const MyType& other) : value(other.value)
		{
			std::cout << "Copy is called" << std::endl;
		}
		int value;
	};

	Stack<MyType*> st;
	for (int i = 0; i < 10; ++i)
	{
		st.Push(new MyType(i * 100));
	}
	st.Display();
	st.Pop();
	st.Pop();
	st.Display();
}