#include <iostream>

class IPlayer
{
public:
	virtual bool IsValid() = 0;
	virtual bool Equals(const IPlayer *other) = 0;
};

class ILocalPlayer : virtual public IPlayer
{
public:
	virtual bool CanShoot() = 0;
};

class SourcePlayer : virtual public IPlayer
{
public:
	SourcePlayer(int index)
		: index(index)
	{

	}

	virtual bool IsValid()
	{
		return true;
	}
	
	virtual bool Equals(const IPlayer *other)
	{
		//const SourcePlayer *p = dynamic_cast<const SourcePlayer*>(other);
		//return index == p->index;
		return Equals(dynamic_cast<const SourcePlayer*>(other));
	}
	
	bool Equals(const SourcePlayer *other)
	{
		return index == other->index;
	}

private:
	int index;
};

class SourceLocalPlayer : public SourcePlayer, public ILocalPlayer
{
public:
	SourceLocalPlayer(int index)
		: SourcePlayer(index)
	{

	}

	virtual bool CanShoot()
	{
		return false;
	}
};

int main()
{
	ILocalPlayer *local = new SourceLocalPlayer(1);
	IPlayer *player = new SourcePlayer(1);
	
	std::cout << (local->Equals(player) ? "gleich" : "ungleich");
	
	delete player;
	delete local;
}