xref: /aoo41x/main/salhelper/test/rtti/rttitest.cxx (revision f3cac8d6)
1*f3cac8d6SAndrew Rist /**************************************************************
2*f3cac8d6SAndrew Rist  *
3*f3cac8d6SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*f3cac8d6SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*f3cac8d6SAndrew Rist  * distributed with this work for additional information
6*f3cac8d6SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*f3cac8d6SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*f3cac8d6SAndrew Rist  * "License"); you may not use this file except in compliance
9*f3cac8d6SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*f3cac8d6SAndrew Rist  *
11*f3cac8d6SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*f3cac8d6SAndrew Rist  *
13*f3cac8d6SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*f3cac8d6SAndrew Rist  * software distributed under the License is distributed on an
15*f3cac8d6SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*f3cac8d6SAndrew Rist  * KIND, either express or implied.  See the License for the
17*f3cac8d6SAndrew Rist  * specific language governing permissions and limitations
18*f3cac8d6SAndrew Rist  * under the License.
19*f3cac8d6SAndrew Rist  *
20*f3cac8d6SAndrew Rist  *************************************************************/
21*f3cac8d6SAndrew Rist 
22cdf0e10cSrcweir #include <rtl/ustring>
23cdf0e10cSrcweir #include <stdio.h>
24cdf0e10cSrcweir #include <typeinfo>
25cdf0e10cSrcweir #include "samplelibrtti.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir 
28cdf0e10cSrcweir //using namespace salhelper;
29cdf0e10cSrcweir using namespace rtl;
30cdf0e10cSrcweir 
31cdf0e10cSrcweir 
32cdf0e10cSrcweir 
main(int argc,char * argv[],char * envp[])33cdf0e10cSrcweir int main( int argc, char *argv[ ], char *envp[ ] )
34cdf0e10cSrcweir {
35cdf0e10cSrcweir 	MyClassB b;
36cdf0e10cSrcweir 	MyClassA* pA= &b;
37cdf0e10cSrcweir 	// test the virtual function
38cdf0e10cSrcweir 	pA->funcA();
39cdf0e10cSrcweir 
40cdf0e10cSrcweir //	const type_info& i1= typeid ( b);
41cdf0e10cSrcweir //	const type_info& i2= typeid( pA);
42cdf0e10cSrcweir 
43cdf0e10cSrcweir 	if( typeid( b) == typeid( pA))
44cdf0e10cSrcweir 		printf("\nsame types");
45cdf0e10cSrcweir 
46cdf0e10cSrcweir 
47cdf0e10cSrcweir 	MyClassB* pB= dynamic_cast<MyClassB* >( pA);
48cdf0e10cSrcweir         pB->funcA();
49cdf0e10cSrcweir 	return 0;
50cdf0e10cSrcweir }
51