or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Syncing
xxxxxxxxxx
tags:
python
物件導向程式設計
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →專有名詞介紹
類別(class):
物件(object):
屬性(properties):
方法(functions):
定義(definition):
宣告(declaration):
公開(public):
私有(private):
* 避免不小心修改到內部屬性
* 簡化使用者操作
* 隱藏內部執行步驟
層次
注意事項
範例一
定義一個類別叫做「車」,實作「汽車、卡車」物件
範例二:根據參數初始化物件屬性
__init__():
觀念
類別中的函數若要指定是該類別的屬性,記得要加self
沒加self會被認為是函數內的變數
範例三 為何需要私有屬性或方法
繼承(inheritance)
引用上一輩的初始化方法
鍊狀繼承(chained inheritance)
多重繼承(multiple inheritance)
範例四:(註一)
範例: 日記軟體
軟體:
備註
S20200609 來自amos老師的網站。物件導向程式設計