04 2014 档案

摘要:1.获取子串的substr(string, start[, count]): start指定开始位置;count表示提取的长度,如果没有指定,则表示提取到字符串的结尾。SQL> select substr('Hello, world!', 8, 5) from dual; SUBSTR('HELLO... 阅读全文
posted @ 2014-04-18 17:42 百里飞猫
摘要:考虑下面的代码: 1 #include 2 #include 3 using std::cout; 4 using std::endl; 5 using std::string; 6 7 class Test 8 { 9 public:10 Test()11 {12 ... 阅读全文
posted @ 2014-04-14 01:24 百里飞猫
摘要:C++里有const成员函数,那是否有const非成员函数呢?试试看:void func(int i) const{ return;}尝试编译下:[tortoise@sea temp]$ g++ -o test test.cctest.cc:6:18: error: non-member function ‘void func(int)’ cannot have cv-qualifier void func(int i) const ^[tortoise@sea temp]$ 非成员函数不能有cv限定符! 阅读全文
posted @ 2014-04-12 14:17 百里飞猫
摘要:代码如下,按理应该调用复制运算符啊,为何却是调用了复制构造函数: 1 #include 2 using std::cout; 3 using std::endl; 4 using std::string; 5 6 class Test 7 { 8 public: 9 Test()10 { 11 cout << "The default constructor is called!" << endl;12 } 13 14 Test(const Test &rhs)15 :strTest(rhs.strTest)16 { ... 阅读全文
posted @ 2014-04-10 00:18 百里飞猫
摘要:以反斜线结尾时,会将下一行和当前行连接在一起,即使当前行是注释行:int main(){ int i = 0; // backslash test \ if(i > 0) { std::cout << "i is ... 阅读全文
posted @ 2014-04-09 09:22 百里飞猫