#include <iostream>

class Animal
{
public:
	virtual ~Animal(){}
};

class Dog : public Animal
{
public:
	virtual void woof() { }
};

class Cat : public Animal
{
public:
	virtual void meow() { }
};

int main()
{
	Cat felix;
	Cat* the_cat = &felix;
	// "normal" cast, which disallows casting between unrelated class hierarchies,
	// but while downcasting assumes the programmer knows 
	Dog* the_dog_1 = static_cast<Dog*>(the_cat);
	// your cast with testing validity at runtime
	// (doesn't fail at compile time, because there may be a CatDog
	// derived from Cat and Dog in other translation unit)
	Dog* the_dog_2 = dynamic_cast<Dog*>(the_cat);
	// "everything goes" byte reinterpretation cast
	Dog* the_dog_3 = reinterpret_cast<Dog*>(the_cat);
	
	the_dog_1->woof();
	
	if(the_dog_2)
		the_dog_2->woof();
		
	the_dog_3->woof();
}