
#include <iostream>
#include <algorithm>
#include <list>

using namespace std;

// Item
class MyA { };
class MyB { };

enum MyTypeEnum
{
	myAType,
	myBType
};

class MyItem
{
public:
	explicit MyItem(MyTypeEnum theType) : myType(theType) { };
	void Print();

private:
	MyTypeEnum myType;
};

void MyItem::Print()
{
	if(myType == myAType)
		cout << "MyItem - myA" << endl;
	else if(myType == myBType)
		cout << "MyItem - myB" << endl;
}

// ItemList
class MyItemList
{
public:
	void AddItem(MyItem theItem);
	void PrintItems();

private:
	list<MyItem> myList;
};

void MyItemList::AddItem(MyItem theItem)
{
	myList.push_back(theItem);
}

void MyItemList::PrintItems()
{
	for_each(myList.cbegin(), myList.cend(), [](MyItem i)
	{
		i.Print();
	});
}

// main
int main(int argc, char * argv[])
{
	MyItemList itemList;

	// itemList soll die Elemente tatsächlich besitzen
	{
		itemList.AddItem(MyItem(myAType));
		itemList.AddItem(MyItem(myBType));
	}

	itemList.PrintItems();

	return 0;
}
