c++
,物件導向
,指標
,static
,class
Wed, Jul 21, 2021 2:31 PM
- 學習 c++ 物件導向 Image Not Showing Possible Reasons The image file may be corruptedThe server hosting the image is unavailableThe image path is incorrectThe image format is not supported Learn More →
- classes(類別) Image Not Showing Possible Reasons The image file may be corruptedThe server hosting the image is unavailableThe image path is incorrectThe image format is not supported Learn More →
- constructors & destructors(建構子&解構子) Image Not Showing Possible Reasons The image file may be corruptedThe server hosting the image is unavailableThe image path is incorrectThe image format is not supported Learn More →
- Overloading Constructors(重載建構子) Image Not Showing Possible Reasons The image file may be corruptedThe server hosting the image is unavailableThe image path is incorrectThe image format is not supported Learn More →
- Pointers to Classes(類別指標) Image Not Showing Possible Reasons The image file may be corruptedThe server hosting the image is unavailableThe image path is incorrectThe image format is not supported Learn More →
- Overloading Operators(重載運算子) Image Not Showing Possible Reasons The image file may be corruptedThe server hosting the image is unavailableThe image path is incorrectThe image format is not supported Learn More →
- This(this指標) Image Not Showing Possible Reasons The image file may be corruptedThe server hosting the image is unavailableThe image path is incorrectThe image format is not supported Learn More →
- Static Members(靜態成員) Image Not Showing Possible Reasons The image file may be corruptedThe server hosting the image is unavailableThe image path is incorrectThe image format is not supported Learn More →
- Friend(朋友函式) Image Not Showing Possible Reasons The image file may be corruptedThe server hosting the image is unavailableThe image path is incorrectThe image format is not supported Learn More →
- Inheritance(繼承) Image Not Showing Possible Reasons The image file may be corruptedThe server hosting the image is unavailableThe image path is incorrectThe image format is not supported Learn More →
- Pointers to Base Class(父類別指標) Image Not Showing Possible Reasons The image file may be corruptedThe server hosting the image is unavailableThe image path is incorrectThe image format is not supported Learn More →
- Polymorphism:Virtual Members(虛擬成員) Image Not Showing Possible Reasons The image file may be corruptedThe server hosting the image is unavailableThe image path is incorrectThe image format is not supported Learn More →
- Polymorphism:Abstract Base Classes(抽象類別) Image Not Showing Possible Reasons The image file may be corruptedThe server hosting the image is unavailableThe image path is incorrectThe image format is not supported Learn More →
歡迎觀賞!!
練習使用classes,並且了解到public和private的使用方式,以及成員函式的宣告,可以先宣告原型再利用外部宣告。
練習使用constructors & destructors,了解建構子和解構子的用途,以及使用方法。
!!解構子最常使用的地方在於動態管理的記憶體釋放。
預設的建構子為 cat(),有兩種,第一種是無初始化空的建構子,第二種是可以初始化的建構子
empty constructor
copy constructor
多載函式
cat()
cat(int,int)
可以寫成兩種同樣名稱的函式。
!!取代了預設的函式,所以原本的預設函式已經不存在了
練習使用指向class的指標,以及pointer的使用方式。