#include <iostream>
#include <typeinfo>
using namespace std;

struct Android{};
struct IOS{};

struct Printer{virtual ~Printer(){}};
struct Writer{virtual ~Writer(){}};
struct Connector{virtual ~Connector(){}};

struct AndroidPrinter : Printer{};
struct AndroidWriter : Writer{};
struct AndroidConnector : Connector{};

struct IOSPrinter : Printer{};
struct IOSWriter : Writer{};
struct IOSConnector : Connector{};

template <typename T>
struct ConcreteComponentFactory;

template <>
struct ConcreteComponentFactory<Android>
{
	static Printer *CreatePrinter()
	{ return new AndroidPrinter(); }
	static Writer *CreateWriter()
	{ return new AndroidWriter(); }
	static Connector *CreateConnector()
	{ return new AndroidConnector(); }
};

template <>
struct ConcreteComponentFactory<IOS>
{
	static Printer *CreatePrinter()
	{ return new IOSPrinter(); }
	static Writer *CreateWriter()
	{ return new IOSWriter(); }
	static Connector *CreateConnector()
	{ return new IOSConnector(); }
};

#define PLATFORM 0
#if PLATFORM==0
using Platform = Android;
#else
using Platform = IOS;
#endif

using ComponentFactory = ConcreteComponentFactory<Platform>;

int main() {
	std::cout << typeid(*ComponentFactory::CreateWriter()).name();
	return 0;
}