Skip to main content

オーバーライド.子での実装を必須にする(abstract,purevirtual)

Python

py
@abstractmethod
def method01(self):
pass

Python3 : @abstractmethod を使用 Python2 には文法的には無いので、親の定義で raise NotImplementedException みたいにしておく

Swift

swift
class Class01 {
func method01() -> String {
preconditionFailure("Implement this!")
}
}