HELLO·Android
系统源代码
IT资讯
技术文章
我的收藏
注册
登录
-
我收藏的文章
创建代码块
我的代码块
我的账号
Lollipop MR1
|
5.1.0_r3
下载
查看原文件
收藏
根目录
ndk
sources
cxx-stl
gabi++
tests
dynamic_cast3.cpp
//===------------------------- dynamic_cast3.cpp --------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #include
/* A1 A2 A3 */ namespace t1 { struct A1 { char _[43981]; virtual ~A1() {} A1* getA1() {return this;} }; struct A2 { char _[34981]; virtual ~A2() {} A2* getA2() {return this;} }; struct A3 { char _[93481]; virtual ~A3() {} A3* getA3() {return this;} }; void test() { A1 a1; A2 a2; A3 a3; assert(dynamic_cast
(a1.getA1()) == a1.getA1()); assert(dynamic_cast
(a2.getA2()) == 0); assert(dynamic_cast
(a3.getA3()) == 0); assert(dynamic_cast
(a1.getA1()) == 0); assert(dynamic_cast
(a2.getA2()) == a2.getA2()); assert(dynamic_cast
(a3.getA3()) == 0); assert(dynamic_cast
(a1.getA1()) == 0); assert(dynamic_cast
(a2.getA2()) == 0); assert(dynamic_cast
(a3.getA3()) == a3.getA3()); } } // t1 /* A1 A2 | A3 */ namespace t2 { struct A1 { char _[43981]; virtual ~A1() {} A1* getA1() {return this;} }; struct A2 { char _[34981]; virtual ~A2() {} A2* getA2() {return this;} }; struct A3 : public A1 { char _[93481]; virtual ~A3() {} A3* getA3() {return this;} }; void test() { A1 a1; A2 a2; A3 a3; assert(dynamic_cast
(a1.getA1()) == a1.getA1()); assert(dynamic_cast
(a2.getA2()) == 0); assert(dynamic_cast
(a3.getA1()) == a3.getA1()); assert(dynamic_cast
(a3.getA3()) == a3.getA1()); assert(dynamic_cast
(a1.getA1()) == 0); assert(dynamic_cast
(a2.getA2()) == a2.getA2()); assert(dynamic_cast
(a3.getA1()) == 0); assert(dynamic_cast
(a3.getA3()) == 0); assert(dynamic_cast
(a1.getA1()) == 0); assert(dynamic_cast
(a2.getA2()) == 0); assert(dynamic_cast
(a3.getA1()) == a3.getA3()); assert(dynamic_cast
(a3.getA3()) == a3.getA3()); } } // t2 namespace t3 { struct A1 { char _[43981]; virtual ~A1() {} A1* getA1() {return this;} }; struct A2 { char _[34981]; virtual ~A2() {} A2* getA2() {return this;} }; struct A3 : public virtual A1 { char _[93481]; virtual ~A3() {} A3* getA3() {return this;} }; void test() { A1 a1; A2 a2; A3 a3; assert(dynamic_cast
(a1.getA1()) == a1.getA1()); assert(dynamic_cast
(a2.getA2()) == 0); assert(dynamic_cast
(a3.getA1()) == a3.getA1()); assert(dynamic_cast
(a3.getA3()) == a3.getA1()); assert(dynamic_cast
(a1.getA1()) == 0); assert(dynamic_cast
(a2.getA2()) == a2.getA2()); assert(dynamic_cast
(a3.getA1()) == 0); assert(dynamic_cast
(a3.getA3()) == 0); assert(dynamic_cast
(a1.getA1()) == 0); assert(dynamic_cast
(a2.getA2()) == 0); assert(dynamic_cast
(a3.getA1()) == a3.getA3()); assert(dynamic_cast
(a3.getA3()) == a3.getA3()); } } // t3 namespace t4 { struct A1 { char _[43981]; virtual ~A1() {} A1* getA1() {return this;} }; struct A2 { char _[34981]; virtual ~A2() {} A2* getA2() {return this;} }; struct A3 : private A1 { char _[93481]; virtual ~A3() {} A1* getA1() {return this;} A3* getA3() {return this;} }; void test() { A1 a1; A2 a2; A3 a3; assert(dynamic_cast
(a1.getA1()) == a1.getA1()); assert(dynamic_cast
(a2.getA2()) == 0); assert(dynamic_cast
(a3.getA1()) == a3.getA1()); assert(dynamic_cast
(a1.getA1()) == 0); assert(dynamic_cast
(a2.getA2()) == a2.getA2()); assert(dynamic_cast
(a3.getA1()) == 0); assert(dynamic_cast
(a3.getA3()) == 0); assert(dynamic_cast
(a1.getA1()) == 0); assert(dynamic_cast
(a2.getA2()) == 0); assert(dynamic_cast
(a3.getA1()) == 0); assert(dynamic_cast
(a3.getA3()) == a3.getA3()); } } // t4 namespace t5 { struct A1 { char _[43981]; virtual ~A1() {} A1* getA1() {return this;} }; struct A2 { char _[34981]; virtual ~A2() {} A2* getA2() {return this;} }; struct A3 : private virtual A1 { char _[93481]; virtual ~A3() {} A1* getA1() {return this;} A3* getA3() {return this;} }; void test() { A1 a1; A2 a2; A3 a3; assert(dynamic_cast
(a1.getA1()) == a1.getA1()); assert(dynamic_cast
(a2.getA2()) == 0); assert(dynamic_cast
(a3.getA1()) == a3.getA1()); assert(dynamic_cast
(a1.getA1()) == 0); assert(dynamic_cast
(a2.getA2()) == a2.getA2()); assert(dynamic_cast
(a3.getA1()) == 0); assert(dynamic_cast
(a3.getA3()) == 0); assert(dynamic_cast
(a1.getA1()) == 0); assert(dynamic_cast
(a2.getA2()) == 0); assert(dynamic_cast
(a3.getA1()) == 0); assert(dynamic_cast
(a3.getA3()) == a3.getA3()); } } // t5 /* A1 A2 \ / A3 */ namespace t6 { struct A1 { char _[43981]; virtual ~A1() {} A1* getA1() {return this;} }; struct A2 { char _[34981]; virtual ~A2() {} A2* getA2() {return this;} }; struct A3 : public A1, public A2 { char _[93481]; virtual ~A3() {} A1* getA1() {return this;} A2* getA2() {return this;} A3* getA3() {return this;} }; void test() { A1 a1; A2 a2; A3 a3; assert(dynamic_cast
(a1.getA1()) == a1.getA1()); assert(dynamic_cast
(a2.getA2()) == 0); assert(dynamic_cast
(a3.getA1()) == a3.getA1()); assert(dynamic_cast
(a3.getA2()) == a3.getA1()); assert(dynamic_cast
(a3.getA3()) == a3.getA1()); assert(dynamic_cast
(a1.getA1()) == 0); assert(dynamic_cast
(a2.getA2()) == a2.getA2()); assert(dynamic_cast
(a3.getA1()) == a3.getA2()); assert(dynamic_cast
(a3.getA2()) == a3.getA2()); assert(dynamic_cast
(a3.getA3()) == a3.getA2()); assert(dynamic_cast
(a1.getA1()) == 0); assert(dynamic_cast
(a2.getA2()) == 0); assert(dynamic_cast
(a3.getA1()) == a3.getA3()); assert(dynamic_cast
(a3.getA2()) == a3.getA3()); assert(dynamic_cast
(a3.getA3()) == a3.getA3()); } } // t6 namespace t7 { struct A1 { char _[43981]; virtual ~A1() {} A1* getA1() {return this;} }; struct A2 { char _[34981]; virtual ~A2() {} A2* getA2() {return this;} }; struct A3 : public virtual A1, public A2 { char _[93481]; virtual ~A3() {} A1* getA1() {return this;} A2* getA2() {return this;} A3* getA3() {return this;} }; void test() { A1 a1; A2 a2; A3 a3; assert(dynamic_cast
(a1.getA1()) == a1.getA1()); assert(dynamic_cast
(a2.getA2()) == 0); assert(dynamic_cast
(a3.getA1()) == a3.getA1()); assert(dynamic_cast
(a3.getA2()) == a3.getA1()); assert(dynamic_cast
(a3.getA3()) == a3.getA1()); assert(dynamic_cast
(a1.getA1()) == 0); assert(dynamic_cast
(a2.getA2()) == a2.getA2()); assert(dynamic_cast
(a3.getA1()) == a3.getA2()); assert(dynamic_cast
(a3.getA2()) == a3.getA2()); assert(dynamic_cast
(a3.getA3()) == a3.getA2()); assert(dynamic_cast
(a1.getA1()) == 0); assert(dynamic_cast
(a2.getA2()) == 0); assert(dynamic_cast
(a3.getA1()) == a3.getA3()); assert(dynamic_cast
(a3.getA2()) == a3.getA3()); assert(dynamic_cast
(a3.getA3()) == a3.getA3()); } } // t7 namespace t8 { struct A1 { char _[43981]; virtual ~A1() {} A1* getA1() {return this;} }; struct A2 { char _[34981]; virtual ~A2() {} A2* getA2() {return this;} }; struct A3 : private A1, public A2 { char _[93481]; virtual ~A3() {} A1* getA1() {return this;} A2* getA2() {return this;} A3* getA3() {return this;} }; void test() { A1 a1; A2 a2; A3 a3; assert(dynamic_cast
(a1.getA1()) == a1.getA1()); assert(dynamic_cast
(a2.getA2()) == 0); assert(dynamic_cast
(a3.getA1()) == a3.getA1()); assert(dynamic_cast
(a3.getA2()) == 0); assert(dynamic_cast
(a1.getA1()) == 0); assert(dynamic_cast
(a2.getA2()) == a2.getA2()); assert(dynamic_cast
(a3.getA1()) == 0); assert(dynamic_cast
(a3.getA2()) == a3.getA2()); assert(dynamic_cast
(a3.getA3()) == a3.getA2()); assert(dynamic_cast
(a1.getA1()) == 0); assert(dynamic_cast
(a2.getA2()) == 0); assert(dynamic_cast
(a3.getA1()) == 0); assert(dynamic_cast
(a3.getA2()) == a3.getA3()); assert(dynamic_cast
(a3.getA3()) == a3.getA3()); } } // t8 namespace t9 { struct A1 { char _[43981]; virtual ~A1() {} A1* getA1() {return this;} }; struct A2 { char _[34981]; virtual ~A2() {} A2* getA2() {return this;} }; struct A3 : private virtual A1, public A2 { char _[93481]; virtual ~A3() {} A1* getA1() {return this;} A2* getA2() {return this;} A3* getA3() {return this;} }; void test() { A1 a1; A2 a2; A3 a3; assert(dynamic_cast
(a1.getA1()) == a1.getA1()); assert(dynamic_cast
(a2.getA2()) == 0); assert(dynamic_cast
(a3.getA1()) == a3.getA1()); assert(dynamic_cast
(a3.getA2()) == 0); assert(dynamic_cast
(a1.getA1()) == 0); assert(dynamic_cast
(a2.getA2()) == a2.getA2()); assert(dynamic_cast
(a3.getA1()) == 0); assert(dynamic_cast
(a3.getA2()) == a3.getA2()); assert(dynamic_cast
(a3.getA3()) == a3.getA2()); assert(dynamic_cast
(a1.getA1()) == 0); assert(dynamic_cast
(a2.getA2()) == 0); assert(dynamic_cast
(a3.getA1()) == 0); assert(dynamic_cast
(a3.getA2()) == a3.getA3()); assert(dynamic_cast
(a3.getA3()) == a3.getA3()); } } // t9 namespace t10 { struct A1 { char _[43981]; virtual ~A1() {} A1* getA1() {return this;} }; struct A2 { char _[34981]; virtual ~A2() {} A2* getA2() {return this;} }; struct A3 : public virtual A1, public virtual A2 { char _[93481]; virtual ~A3() {} A1* getA1() {return this;} A2* getA2() {return this;} A3* getA3() {return this;} }; void test() { A1 a1; A2 a2; A3 a3; assert(dynamic_cast
(a1.getA1()) == a1.getA1()); assert(dynamic_cast
(a2.getA2()) == 0); assert(dynamic_cast
(a3.getA1()) == a3.getA1()); assert(dynamic_cast
(a3.getA2()) == a3.getA1()); assert(dynamic_cast
(a3.getA3()) == a3.getA1()); assert(dynamic_cast
(a1.getA1()) == 0); assert(dynamic_cast
(a2.getA2()) == a2.getA2()); assert(dynamic_cast
(a3.getA1()) == a3.getA2()); assert(dynamic_cast
(a3.getA2()) == a3.getA2()); assert(dynamic_cast
(a3.getA3()) == a3.getA2()); assert(dynamic_cast
(a1.getA1()) == 0); assert(dynamic_cast
(a2.getA2()) == 0); assert(dynamic_cast
(a3.getA1()) == a3.getA3()); assert(dynamic_cast
(a3.getA2()) == a3.getA3()); assert(dynamic_cast
(a3.getA3()) == a3.getA3()); } } // t10 namespace t11 { struct A1 { char _[43981]; virtual ~A1() {} A1* getA1() {return this;} }; struct A2 { char _[34981]; virtual ~A2() {} A2* getA2() {return this;} }; struct A3 : private A1, public virtual A2 { char _[93481]; virtual ~A3() {} A1* getA1() {return this;} A2* getA2() {return this;} A3* getA3() {return this;} }; void test() { A1 a1; A2 a2; A3 a3; assert(dynamic_cast
(a1.getA1()) == a1.getA1()); assert(dynamic_cast
(a2.getA2()) == 0); assert(dynamic_cast
(a3.getA1()) == a3.getA1()); assert(dynamic_cast
(a3.getA2()) == 0); assert(dynamic_cast
(a1.getA1()) == 0); assert(dynamic_cast
(a2.getA2()) == a2.getA2()); assert(dynamic_cast
(a3.getA1()) == 0); assert(dynamic_cast
(a3.getA2()) == a3.getA2()); assert(dynamic_cast
(a3.getA3()) == a3.getA2()); assert(dynamic_cast
(a1.getA1()) == 0); assert(dynamic_cast
(a2.getA2()) == 0); assert(dynamic_cast
(a3.getA1()) == 0); assert(dynamic_cast
(a3.getA2()) == a3.getA3()); assert(dynamic_cast
(a3.getA3()) == a3.getA3()); } } // t11 namespace t12 { struct A1 { char _[43981]; virtual ~A1() {} A1* getA1() {return this;} }; struct A2 { char _[34981]; virtual ~A2() {} A2* getA2() {return this;} }; struct A3 : private virtual A1, public virtual A2 { char _[93481]; virtual ~A3() {} A1* getA1() {return this;} A2* getA2() {return this;} A3* getA3() {return this;} }; void test() { A1 a1; A2 a2; A3 a3; assert(dynamic_cast
(a1.getA1()) == a1.getA1()); assert(dynamic_cast
(a2.getA2()) == 0); assert(dynamic_cast
(a3.getA1()) == a3.getA1()); assert(dynamic_cast
(a3.getA2()) == 0); assert(dynamic_cast
(a1.getA1()) == 0); assert(dynamic_cast
(a2.getA2()) == a2.getA2()); assert(dynamic_cast
(a3.getA1()) == 0); assert(dynamic_cast
(a3.getA2()) == a3.getA2()); assert(dynamic_cast
(a3.getA3()) == a3.getA2()); assert(dynamic_cast
(a1.getA1()) == 0); assert(dynamic_cast
(a2.getA2()) == 0); assert(dynamic_cast
(a3.getA1()) == 0); assert(dynamic_cast
(a3.getA2()) == a3.getA3()); assert(dynamic_cast
(a3.getA3()) == a3.getA3()); } } // t12 namespace t13 { struct A1 { char _[43981]; virtual ~A1() {} A1* getA1() {return this;} }; struct A2 { char _[34981]; virtual ~A2() {} A2* getA2() {return this;} }; struct A3 : private A1, private A2 { char _[93481]; virtual ~A3() {} A1* getA1() {return this;} A2* getA2() {return this;} A3* getA3() {return this;} }; void test() { A1 a1; A2 a2; A3 a3; assert(dynamic_cast
(a1.getA1()) == a1.getA1()); assert(dynamic_cast
(a2.getA2()) == 0); assert(dynamic_cast
(a3.getA1()) == a3.getA1()); assert(dynamic_cast
(a3.getA2()) == 0); assert(dynamic_cast
(a1.getA1()) == 0); assert(dynamic_cast
(a2.getA2()) == a2.getA2()); assert(dynamic_cast
(a3.getA1()) == 0); assert(dynamic_cast
(a3.getA2()) == a3.getA2()); assert(dynamic_cast
(a1.getA1()) == 0); assert(dynamic_cast
(a2.getA2()) == 0); assert(dynamic_cast
(a3.getA1()) == 0); assert(dynamic_cast
(a3.getA2()) == 0); assert(dynamic_cast
(a3.getA3()) == a3.getA3()); } } // t13 namespace t14 { struct A1 { char _[43981]; virtual ~A1() {} A1* getA1() {return this;} }; struct A2 { char _[34981]; virtual ~A2() {} A2* getA2() {return this;} }; struct A3 : private virtual A1, private A2 { char _[93481]; virtual ~A3() {} A1* getA1() {return this;} A2* getA2() {return this;} A3* getA3() {return this;} }; void test() { A1 a1; A2 a2; A3 a3; assert(dynamic_cast
(a1.getA1()) == a1.getA1()); assert(dynamic_cast
(a2.getA2()) == 0); assert(dynamic_cast
(a3.getA1()) == a3.getA1()); assert(dynamic_cast
(a3.getA2()) == 0); assert(dynamic_cast
(a1.getA1()) == 0); assert(dynamic_cast
(a2.getA2()) == a2.getA2()); assert(dynamic_cast
(a3.getA1()) == 0); assert(dynamic_cast
(a3.getA2()) == a3.getA2()); assert(dynamic_cast
(a1.getA1()) == 0); assert(dynamic_cast
(a2.getA2()) == 0); assert(dynamic_cast
(a3.getA1()) == 0); assert(dynamic_cast
(a3.getA2()) == 0); assert(dynamic_cast
(a3.getA3()) == a3.getA3()); } } // t14 namespace t15 { struct A1 { char _[43981]; virtual ~A1() {} A1* getA1() {return this;} }; struct A2 { char _[34981]; virtual ~A2() {} A2* getA2() {return this;} }; struct A3 : private virtual A1, private virtual A2 { char _[93481]; virtual ~A3() {} A1* getA1() {return this;} A2* getA2() {return this;} A3* getA3() {return this;} }; void test() { A1 a1; A2 a2; A3 a3; assert(dynamic_cast
(a1.getA1()) == a1.getA1()); assert(dynamic_cast
(a2.getA2()) == 0); assert(dynamic_cast
(a3.getA1()) == a3.getA1()); assert(dynamic_cast
(a3.getA2()) == 0); assert(dynamic_cast
(a1.getA1()) == 0); assert(dynamic_cast
(a2.getA2()) == a2.getA2()); assert(dynamic_cast
(a3.getA1()) == 0); assert(dynamic_cast
(a3.getA2()) == a3.getA2()); assert(dynamic_cast
(a1.getA1()) == 0); assert(dynamic_cast
(a2.getA2()) == 0); assert(dynamic_cast
(a3.getA1()) == 0); assert(dynamic_cast
(a3.getA2()) == 0); assert(dynamic_cast
(a3.getA3()) == a3.getA3()); } } // t15 /* A1 | A2 | A3 */ namespace t16 { struct A1 { char _[43981]; virtual ~A1() {} A1* getA1() {return this;} }; struct A2 : public A1 { char _[34981]; virtual ~A2() {} A1* getA1() {return this;} A2* getA2() {return this;} }; struct A3 : public A2 { char _[93481]; virtual ~A3() {} A1* getA1() {return this;} A2* getA2() {return this;} A3* getA3() {return this;} }; void test() { A1 a1; A2 a2; A3 a3; assert(dynamic_cast
(a1.getA1()) == a1.getA1()); assert(dynamic_cast
(a2.getA1()) == a2.getA1()); assert(dynamic_cast
(a2.getA2()) == a2.getA1()); assert(dynamic_cast
(a3.getA1()) == a3.getA1()); assert(dynamic_cast
(a3.getA2()) == a3.getA1()); assert(dynamic_cast
(a3.getA3()) == a3.getA1()); assert(dynamic_cast
(a1.getA1()) == 0); assert(dynamic_cast
(a2.getA1()) == a2.getA2()); assert(dynamic_cast
(a2.getA2()) == a2.getA2()); assert(dynamic_cast
(a3.getA1()) == a3.getA2()); assert(dynamic_cast
(a3.getA2()) == a3.getA2()); assert(dynamic_cast
(a3.getA3()) == a3.getA2()); assert(dynamic_cast
(a1.getA1()) == 0); assert(dynamic_cast
(a2.getA1()) == 0); assert(dynamic_cast
(a2.getA2()) == 0); assert(dynamic_cast
(a3.getA1()) == a3.getA3()); assert(dynamic_cast
(a3.getA2()) == a3.getA3()); assert(dynamic_cast
(a3.getA3()) == a3.getA3()); } } // t16 namespace t17 { struct A1 { char _[43981]; virtual ~A1() {} A1* getA1() {return this;} }; struct A2 : public virtual A1 { char _[34981]; virtual ~A2() {} A1* getA1() {return this;} A2* getA2() {return this;} }; struct A3 : public A2 { char _[93481]; virtual ~A3() {} A1* getA1() {return this;} A2* getA2() {return this;} A3* getA3() {return this;} }; void test() { A1 a1; A2 a2; A3 a3; assert(dynamic_cast
(a1.getA1()) == a1.getA1()); assert(dynamic_cast
(a2.getA1()) == a2.getA1()); assert(dynamic_cast
(a2.getA2()) == a2.getA1()); assert(dynamic_cast
(a3.getA1()) == a3.getA1()); assert(dynamic_cast
(a3.getA2()) == a3.getA1()); assert(dynamic_cast
(a3.getA3()) == a3.getA1()); assert(dynamic_cast
(a1.getA1()) == 0); assert(dynamic_cast
(a2.getA1()) == a2.getA2()); assert(dynamic_cast
(a2.getA2()) == a2.getA2()); assert(dynamic_cast
(a3.getA1()) == a3.getA2()); assert(dynamic_cast
(a3.getA2()) == a3.getA2()); assert(dynamic_cast
(a3.getA3()) == a3.getA2()); assert(dynamic_cast
(a1.getA1()) == 0); assert(dynamic_cast
(a2.getA1()) == 0); assert(dynamic_cast
(a2.getA2()) == 0); assert(dynamic_cast
(a3.getA1()) == a3.getA3()); assert(dynamic_cast
(a3.getA2()) == a3.getA3()); assert(dynamic_cast
(a3.getA3()) == a3.getA3()); } } // t17 namespace t18 { struct A1 { char _[43981]; virtual ~A1() {} A1* getA1() {return this;} }; struct A2 : private A1 { char _[34981]; virtual ~A2() {} A1* getA1() {return this;} A2* getA2() {return this;} }; struct A3 : public A2 { char _[93481]; virtual ~A3() {} A2* getA2() {return this;} A3* getA3() {return this;} }; void test() { A1 a1; A2 a2; A3 a3; assert(dynamic_cast
(a1.getA1()) == a1.getA1()); assert(dynamic_cast
(a2.getA1()) == a2.getA1()); assert(dynamic_cast
(a3.getA1()) == a3.getA1()); assert(dynamic_cast
(a1.getA1()) == 0); assert(dynamic_cast
(a2.getA1()) == 0); assert(dynamic_cast
(a2.getA2()) == a2.getA2()); assert(dynamic_cast
(a3.getA1()) == 0); assert(dynamic_cast
(a3.getA2()) == a3.getA2()); assert(dynamic_cast
(a3.getA3()) == a3.getA2()); assert(dynamic_cast
(a1.getA1()) == 0); assert(dynamic_cast
(a2.getA1()) == 0); assert(dynamic_cast
(a2.getA2()) == 0); assert(dynamic_cast
(a3.getA1()) == 0); assert(dynamic_cast
(a3.getA2()) == a3.getA3()); assert(dynamic_cast
(a3.getA3()) == a3.getA3()); } } // t18 namespace t19 { struct A1 { char _[43981]; virtual ~A1() {} A1* getA1() {return this;} }; struct A2 : protected virtual A1 { char _[34981]; virtual ~A2() {} A1* getA1() {return this;} A2* getA2() {return this;} }; struct A3 : public A2 { char _[93481]; virtual ~A3() {} A2* getA2() {return this;} A3* getA3() {return this;} }; void test() { A1 a1; A2 a2; A3 a3; assert(dynamic_cast
(a1.getA1()) == a1.getA1()); assert(dynamic_cast
(a2.getA1()) == a2.getA1()); assert(dynamic_cast
(a3.getA1()) == a3.getA1()); assert(dynamic_cast
(a1.getA1()) == 0); assert(dynamic_cast
(a2.getA1()) == 0); assert(dynamic_cast
(a2.getA2()) == a2.getA2()); assert(dynamic_cast