基类中的this指针,指示其派生类吗?

in baseA
this is baseA class show()
in baseB
this is baseB class show()
in derived
this is derived class show()
in baseA
this is baseA class show()
in baseB
this is baseB class show()
in derived
this is derived class show()
in derived2
this is derived2 class show()
in main()

 od.show()
this is derived class show()
n
 oe.show()
this is derived2 class show()

pA->show()
this is derived2 class show()//<<<<<<<<<<<

pB->show()
this is derived2 class show()//<<<<<<<<<<<

sizeof(*pA):8
sizeof(*pB):32
sizeof(od):48
sizeof(oe):56

请按任意键继续. . .

 

结论:在main之中,题目是正确的。基类的this指针,的确在调用函数的时候,“改向”到了派生类上了。叛变了,傍大款了。

posted on 2009-08-31 11:07  johnphan  阅读(265)  评论(0编辑  收藏  举报

导航