2011年12月23日

摘要: 在构造函数中调用虚成员函数,虽然这是个不很常用的技术,但研究一下可以加深对虚函数机制及对象构造过程的理解。这个问题也和一般直观上的认识有所差异。先看看下面的两个类定义。struct C180 { C180() { foo(); this->foo(); } virtual foo() { cout << "<< C180.foo this: " << this << " vtadr: " << *(void**)this << endl; }};struct C190 : pu 阅读全文

posted @ 2011-12-23 00:39 无忧consume 阅读(228) 评论(0) 推荐(0) 编辑


Copyright © 2024 无忧consume
Powered by .NET 8.0 on Kubernetes