summaryrefslogtreecommitdiff
path: root/salhelper/test/rtti/rttitest.cxx
blob: c44cb9ead34a57ecf4396306736a828cf8fb4701 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
#include <stdio.h>
#include <typeinfo>
#include "samplelibrtti.hxx"

int main( void )
{
    MyClassB b;
    MyClassA* pA= &b;
    // test the virtual function
    pA->funcA();

    if( typeid( b) == typeid( pA))
        printf("\nsame types");

    MyClassB* pB= dynamic_cast<MyClassB* >( pA);
    pB->funcA();
    return 0;
}

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */