xref: /aoo41x/main/salhelper/test/rtti/rttitest.cxx (revision cdf0e10c)
1*cdf0e10cSrcweir #include <rtl/ustring>
2*cdf0e10cSrcweir #include <stdio.h>
3*cdf0e10cSrcweir #include <typeinfo>
4*cdf0e10cSrcweir #include "samplelibrtti.hxx"
5*cdf0e10cSrcweir 
6*cdf0e10cSrcweir 
7*cdf0e10cSrcweir //using namespace salhelper;
8*cdf0e10cSrcweir using namespace rtl;
9*cdf0e10cSrcweir 
10*cdf0e10cSrcweir 
11*cdf0e10cSrcweir 
12*cdf0e10cSrcweir int main( int argc, char *argv[ ], char *envp[ ] )
13*cdf0e10cSrcweir {
14*cdf0e10cSrcweir 	MyClassB b;
15*cdf0e10cSrcweir 	MyClassA* pA= &b;
16*cdf0e10cSrcweir 	// test the virtual function
17*cdf0e10cSrcweir 	pA->funcA();
18*cdf0e10cSrcweir 
19*cdf0e10cSrcweir //	const type_info& i1= typeid ( b);
20*cdf0e10cSrcweir //	const type_info& i2= typeid( pA);
21*cdf0e10cSrcweir 
22*cdf0e10cSrcweir 	if( typeid( b) == typeid( pA))
23*cdf0e10cSrcweir 		printf("\nsame types");
24*cdf0e10cSrcweir 
25*cdf0e10cSrcweir 
26*cdf0e10cSrcweir 	MyClassB* pB= dynamic_cast<MyClassB* >( pA);
27*cdf0e10cSrcweir         pB->funcA();
28*cdf0e10cSrcweir 	return 0;
29*cdf0e10cSrcweir }
30