C++基础
lcmm520
一个小渣渣....
展开
-
C++基础_01
* C++ "Hello World!"#include <iostream> //C++的标准输入输出文件 using namespace std; //命名空间 int main (){ cout << "Hello World"<<"!"<<endl; //cout标准输出 endl<==> "\n" return 0; }* 一个简单的C++类#include <iostre原创 2016-09-26 09:45:23 · 727 阅读 · 0 评论 -
C++基础_02
* inline 内联函数>1.内联函数必须和函数体写在一起,否则编译器直接忽略内联请求 inline int getMax(int a,int b);//Error inline int getMax(int a,int b){ return a> b ? a : b; }>2.内联函数没有普通函数调用时的额外开销(出栈,跳转,返回...) >3.内联函数是一种特殊的函数,具有普通函数的原创 2016-09-28 16:43:39 · 464 阅读 · 0 评论 -
C++基础_03
构造函数和析构函数执行的顺序 #include <iostream> #include <stdlib.h> #include <string.h> #include <ctype.h> using namespace std; class Test{ public: Test(char * name){ memset(this->name,0,sizeof(this->na原创 2016-09-28 16:50:28 · 280 阅读 · 0 评论 -
C++基础_04
new and delete /* new 和 delete 的基本使用 */ #include <iostream> #include <stdio.h> #include <stdlib.h> #include <ctype.h> #include <string.h> #include <string>using namespace std;int main(int argc, char *原创 2016-10-02 21:02:10 · 190 阅读 · 0 评论 -
C++基础_05
const 修饰类的成员函数 #include <iostream>using namespace std;class Test{public : void getNum() const { /* void getNum() const <==> void getNum(const Test * const this); 1)con原创 2016-10-08 17:13:33 · 224 阅读 · 0 评论