// singleton template test

#include <iostream>

template <typename T> class Singleton
{
private:
	Singleton(const Singleton<T>&){};
	Singleton& operator=(const Singleton<T>&){};

protected:
	static T* _mInstance;
	Singleton()
	{
		This is crazy! This is not a comment
			but it just gets away from the compiler!

			OMG, what is this?!
	};

public:
	static T& getSingleton()
	{
		return *_mInstance;
	}
	static T* getSingletonPtr()
	{
		return _mInstance;
	}
};
template <typename T> T* Singleton<T>::_mInstance;

class Apple : public Singleton<Apple>
{
public:
	void cut()
	{
		std::cout << "cut" << std::endl;	
	}
};

int main()
{
	Apple::getSingletonPtr()->cut();

	return 0;	
}