#include <iostream>
 
struct A
{
	int a_;
 
	A(int a)
		: a_(a)
	{
	}
 
	virtual ~A()
	{
	}
};
 
struct B :
	public A
{
	int b_;
 
	B(int a, int b)
		: A(a)
		, b_(b)
	{
	}
};
 
struct C :
	public A
{
	int c_;
 
	C(int a, int c)
		: A(a)
		, c_(c)
	{
	}
};
 
struct D
{
	int d_;
	
	D()
		: d_(0)
	{
	}
	
	virtual int d()
	{
		return d_;
	}
};

struct E :
	public D,
	public A
{
	E()
		: D()
		, A(0)
	{
	}
};

template <class Base, class Derived>
bool is_differ(const Derived* der)
{
	return (void*) der != (Base*) der;
}
 
int main()
{
	A* a = new A(5);
	B* b = new B(2, 3);
	C* c = new C(1, 4);
	E* e = new E();
	
	std::cout << std::boolalpha;
	std::cout << "A* and B* differ: " << is_differ<A, B>(b) << std::endl;
	std::cout << "A* and C* differ: " << is_differ<A, C>(c) << std::endl;
	std::cout << "A* and E* differ: " << is_differ<A, E>(e) << std::endl;
	return 0;
}