![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
c++知识点
sabcasjkd
是只小猴子
展开
-
[C++]reference variables(引用变量)在pass arguments to functions中的运用
一. reference variable的形式 int a; int & b = a; // b is alias(别名) for a [例] #include <iostream> using namespace std; int main(int argc, const char * argv[]) { int a=10; int & b = a;...原创 2019-02-02 13:34:02 · 304 阅读 · 0 评论 -
[C++复习]04| classes and objects(2)
[note 1] The type and scope of each static member variable must be defined outside the class definition. [form]: type class-name::static-member-name type class-name::static-member-name=initial-value ...原创 2019-06-17 21:42:45 · 133 阅读 · 0 评论 -
[C++复习]03|classes and objects
[note 1] We can define a function outside the class definition inline by using inline in the header line of function definition. [example] class A { ...... public: void getNum(int a, int b); } inlin...原创 2019-06-11 20:10:18 · 190 阅读 · 0 评论 -
[C++笔记]02|functions in C++
[note 1] An example of call by reference #include <iostream> using namespace std; void func(int&a) { cout<<"in func------"<<++a<<endl; } int main(int argc, const char *...原创 2019-06-11 18:41:27 · 102 阅读 · 0 评论 -
notes for C++
[C++笔记]01|Tokens, Expressions and Control Structure [C++笔记]02|functions in C++ [C++复习]03|classes and objects [C++复习]04| classes and objects(2) [C++复习]05| inheritance [C++复习]06|operator overloading and...转载 2019-06-20 11:34:04 · 127 阅读 · 0 评论 -
[C++复习]11|working with files
[note 1] fstream We must include this file in any program that uses files. [note 2] Here are 2 ways to open a file. opening files using constructor (useful when manipulate 1 file) [1] ofstream out...原创 2019-06-20 11:28:33 · 118 阅读 · 0 评论 -
[C++复习]10|managing console I/O operations
[note 1] character by character [1] get char a; cin.get(a); a=cin.get; these 2 prototypes can be used to fetch a character including the blank space, tab and newline character. [2] put cout.put('x');...原创 2019-06-20 10:33:47 · 119 阅读 · 0 评论 -
[C++复习]09|Exception handling
[note 1] general form of the try and catch try { // } catch (type arg) { // } [example 1] //Throw point outside the try block #include<iostream> using namespace std; void divide(int x, int ...原创 2019-06-20 09:42:05 · 133 阅读 · 0 评论 -
[C++复习]08|Templates and STL
[note 1] Function templates template <class T> return-type function-name (arguments of type T) { function body } 在这里插入代码片 [example 1] #include <iostream> using namespace std; template&...原创 2019-06-20 09:15:39 · 117 阅读 · 0 评论 -
[C++复习]07| polymorphism and virtual function
[note 1] #include <iostream> using namespace std; class Base { public: void display(){cout << "\n Display base ";} virtual void show(){cout << "\n show base";} }; class Der...原创 2019-06-19 23:49:32 · 139 阅读 · 0 评论 -
[C++复习]06|operator overloading and type conversion
[note 1] The operators that can only be overloaded as non-static member function of some classes: = , [] , () , -> (As for the static function, it doesn’t has the this pointer, so the operator can...原创 2019-06-19 21:47:56 · 203 阅读 · 0 评论 -
[c++] throw-catch问题1
TEST 1 #include <iostream> using namespace std; int main(int argc, const char * argv[]) { try{ try {throw "help...";} catch(int){cout<<"1in fc...int hanlder"<<end...原创 2019-05-30 18:50:11 · 113 阅读 · 0 评论 -
[C++复习]05| inheritance
[note 1] Protected derivation Both the public and protected members of the base class become protected members of the derived class. [note 2] Ambiguity Resolution in inheritance #include<iostream...原创 2019-06-18 12:37:23 · 117 阅读 · 0 评论