Skip to content

Instantly share code, notes, and snippets.

@daleth90
Last active Oct 27, 2018
Embed
What would you like to do?
abstract class A {
// 編譯錯誤,因為已標記為抽象,所以它無法宣告主體。
public abstract void DoSomething1() {
}
// 正確,請注意要加上分號
public abstract void DoSomething2();
// 正確
protected abstract void DoSomething3();
// 編譯錯誤,虛擬或抽象成員不可為私用
// 這不是單純的語言規範,是有原因的,想一想為什麼?
private abstract void DoSomething4();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment