/*
 * Note that RTTI only works on POD-types and polymorphic-types 
 * (classes w/ virtual functions).
 *
 */
#include <iostream>
#include <typeinfo>

class Oink {
public:
    virtual bool noise() {
        return true;
    }
};

class Bar : public Oink {
public:
    bool noise() {
        return true;
    }
};

class Foo : public Oink {
public:
    bool noise() {
        return true;
    }
};

int main( int argc, char* argv[] ) {

    Oink* a = new Bar;
    Oink* b = new Foo;

    if ( typeid( *a ) == typeid( *b ) ) 
        std::cout << "Match" << std::endl;
    else
        std::cout << "No Match" << std::endl;

    if ( typeid( *a ) == typeid( *a ) ) 
        std::cout << "Match" << std::endl;
    else
        std::cout << "No Match" << std::endl;

}
