2012年11月25日

Visual Studio中打开编译器中有虚函数的类的析构函数不是虚函数的警告——/we4265

摘要: C++中一个类如果有虚函数,那么它的析构函数应该也是虚的,否则会出现很多问题。其实visual studi中有一个专门的warning是给这个的,Compiler Warning (level 3) C4265:'class' : class has virtual functions, but destructor is not virtual但是这个warning默认是关闭的,这里可以看所有默... 阅读全文

posted @ 2012-11-25 22:03 fresky 阅读(402) 评论(0) 推荐(0) 编辑

C++编译器什么时候为我们自动生成拷贝构造函数?

摘要: StackOverflow上有个一个有趣的问题,copy by value to function params produce two objects in vs2012 给出程序: #include <iostream>using namespace std;class A{public: A() { cout << "1" << endl; } ~A() { cout ... 阅读全文

posted @ 2012-11-25 21:33 fresky 阅读(1842) 评论(0) 推荐(0) 编辑

导航