mirror of
https://github.com/Light-City/CPlusPlusThings.git
synced 2026-02-04 11:03:58 +08:00
support bazel complie this project and format code.
This commit is contained in:
@@ -1,35 +1,25 @@
|
||||
// 在使用时需要注意:被转换对象obj的类型T1必须是多态类型,即T1必须公有继承自其它类,或者T1拥有虚函数(继承或自定义)。若T1为非多态类型,使用dynamic_cast会报编译错误。
|
||||
|
||||
// A为非多态类型
|
||||
// A为非多态类型
|
||||
|
||||
class A{
|
||||
class A {};
|
||||
|
||||
// B为多态类型
|
||||
|
||||
class B {
|
||||
|
||||
public:
|
||||
virtual ~B() {}
|
||||
};
|
||||
|
||||
//B为多态类型
|
||||
// D为非多态类型
|
||||
|
||||
class B{
|
||||
class D : public A {};
|
||||
|
||||
public: virtual ~B(){}
|
||||
// E为非多态类型
|
||||
|
||||
};
|
||||
|
||||
//D为非多态类型
|
||||
|
||||
class D: public A{
|
||||
|
||||
};
|
||||
|
||||
//E为非多态类型
|
||||
|
||||
class E : private A{
|
||||
|
||||
};
|
||||
|
||||
//F为多态类型
|
||||
|
||||
class F : private B{
|
||||
|
||||
}
|
||||
class E : private A {};
|
||||
|
||||
// F为多态类型
|
||||
|
||||
class F : private B {}
|
||||
|
||||
Reference in New Issue
Block a user