#include using namespace std;
class parent
virtual void print()
virtual void print()
#include using namespace std;
class parent
virtual void print()
return 0;
}
#include using namespace std;
//圖形類
//如果說乙個類,擁有乙個純虛函式
//則稱這個類是乙個抽象類
//不管這個類中,有沒有成員屬性
//只要這個類有純虛函式,就是抽象類。抽象類就是不能例項化的
class shape
;//正方形
//如果乙個普通類,繼承擁有純虛函式的類,必須要重寫這個純虛函式
//如果說不去重寫純虛函式,則依然是抽象類,則依然不能被例項化
class rect: public shape
virtual double getarea()
private:
int a;
};class circle: public shape
virtual double getarea()
private:
int r;
};class ********: public shape
virtual double getarea()
private:
int b;
int h;
};int main()
{ //main中所有使用的變數型別,都是抽象類shape的型別
shape *rp = new rect(10);
cout<<"rectangle is:" 五.三目運算子的加強 c 中,三目運算子可以作為左值使用,而在c中,三目運算子只可當作右值,不可當作左值。include using namespace std void test1 int a 10 int b 20 int c 0 c a六.const的增強 關於const不同位置的修飾含義 當... 十.引用的本質 1.引用所占用的大小,跟指標是相等的。2.常量需要初始化,引用也要初始化,引用可能本質上是一常量 十一.常量指標 對於 int array 10 array是位於 常量區 的。而int r a 而言,r也是位於常量區,它的 r指向a 十二.引用作為函式的返回值 include usi... 四十.建構函式的初始化列表1 include using namespace std class a abcd int geta private int a int b int c class mye mytest int a,int b mytest int array p int malloc ...2017C 基礎 網課筆記(5到9)
2017C 基礎 網課筆記(10到14)
2017C 基礎 網課筆記(40到45)