摘要: #include int main(int argc, char **argv){ const int* pA = new int(3); int& iB = const_cast(*pA); //pA的值可以改变 int* pC = const_cast(pA); iB = 5; *pC = 6; std::cout (iA);//另外申请一块空间,副本 pC = const_cast(&iA); iB = 987; *pC = 999; std::cout << "a=" << iA << std::endl; std 阅读全文
posted @ 2013-11-03 18:45 forgood 阅读(157) 评论(0) 推荐(0) 编辑
摘要: 1 class CObject 2 { 3 friend class CPlyLoader; 4 public: 5 CObject::CObject() : m_pMaterial(NULL) {} 6 CObject::~CObject() 7 { 8 m_Vertex.clear(); 9 m_VertexNormal.clear();10 m_FacetIndices.clear();11 m_FacetNo... 阅读全文
posted @ 2013-11-03 18:29 forgood 阅读(243) 评论(0) 推荐(0) 编辑
摘要: #include namespace Virtual{ class CBase { public: CBase() {} virtual ~CBase() {} void testBase() { print(); } virtual void print() = 0; }; class CDived : public CBase { public: CDived() {} ~CDived() {} void testDived() {testBase();} void print() {std::cout << "CDived's print() is... 阅读全文
posted @ 2013-11-03 09:25 forgood 阅读(166) 评论(0) 推荐(0) 编辑