Is there anything wrong with the following code? class A {}; class B : public A {}; void main() { A* a; B* b=a; }
p*o
2 楼
可怜的引用次数, 在想这两个学位论文的引用可以加上吗?
m*l
3 楼
what's not wrong about the code? ------------ actually, in c# it's definitely wrong. How about C++? does the RTTI check it?
【在 c**********e 的大作中提到】 : Is there anything wrong with the following code? : class A {}; : class B : public A {}; : void main() { : A* a; : B* b=a; : }
p*h
4 楼
当然,算上所有的,所有资源
l*a
5 楼
obviously, base class pointer is not a derive class pointer here u need type conversion B* b=dynamic_casta;
【在 c**********e 的大作中提到】 : Is there anything wrong with the following code? : class A {}; : class B : public A {}; : void main() { : A* a; : B* b=a; : }