美女随心贴,色戒被删除部分,悬赏 粤语
目录
// 错误 #define file_h #include "file.h" #endif // 正确 #define file_h #include "myfile.h" #endif
参考资料
// 错误 char* prt; prt = str; // 正确 char* prt; prt = (char*)str;
// 错误 // file: c.h class c{ }; // file: main #include "c.h" static class c; ... ... // 正确 // file: c.h class c{ }; // file: main #include "c.h" class c; ... ...
// 错误 class c{ int func(){} }; int c = c::func(); ... ... // 正确 class c{ int func(){} }; c temp; int c = temp.func(); ... ...
// 错误 class c{ int a; int &r; c(); }; c::c(){ a = 1; } ... ... // 正确 class c{ int a; int &r; c(); }; c::c():r(a){ a = 1; } ... ...
// 错误 #include<iostream> class c{ private: int a; public: bool func(){ cout << "hello: " << this->a << endl; } c(const c& c){ c.func(); } }; c c1; c c2(c1); // 正确 #include<iostream> class c{ private: int a; public: bool func() const{ cout << "hello: " << this->a << endl; } c(const c& c){ c.func(); } }; c c1; c c2(c1);
参考资料
error:passing 'const student' as 'this' argument of 'void student::print()' discards qualifiers
// 错误 class c{ c(int a=1); } c::c(int a=1){;} // 正确 class c{ c(int a=1); } c::c(int a){;} };
// 错误 class c{ ... ... } // 正确 class c{ ... ... };
#ifdef ×××× //定义一个宏,通常是该头文件名大写 #define ×××× #endif
// 定义c类 // 错误 c{ ... ... }; // 正确 class c{ ... ... };
// 错误 // file: c.h class c{ ... ... }; // file: test.h #include "c.h" c test; ... ... // 正确 // file: c.h class c{ ... ... }; // file: test.h #include "c.h" class test; c test; ... ...
// 错误 class c{ virtual c(); }; virtual c(){ ... ... } // 正确 class c{ virtual c(); }; c(){ ... ... }
// 错误 const char* pathname = "hello.txt"; oflag = o_rdwr|o_append; this->_fd = open(const char* pathname, int oflag); // 正确 const char* pathname = "hello.txt"; oflag = o_rdwr|o_append; int fd = open(pathname, oflag);
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
如何在没有core文件的情况下用dmesg+addr2line定位段错误
用QT制作3D点云显示器——QtDataVisualization
网友评论