但是,注意:枚舉類的構造函數必須為私有的(private)
所以,下圖中沒用枚舉的Group類就用private重寫了構造函數

圖中兩個Group類都做到同樣的效果,但明顯用了枚舉的Group類簡潔很多吧?(笑)
然後,就是帶抽象方法的枚舉:
然後只要調用:

就會出現結果:

若枚舉類只有一個值,可以當作單態設計模式使用
就是這樣:
Download from http : www.xact.es . Before unpack the tar/tgz file, remove attributes with xattr -c xAct_1.x.x.tgz then place the un...
No comments:
Post a Comment