close
In general having getters and setters is showing poor abstraction, don't do it.
Getters and setters provide an illusion of encapsulation,
it will expose private state of an object using public accessors.
將data member 設為private , 主要就是想要隱藏他 , 但如果又用
getter or setter 來對他進行存取 , 這就違反了當初想要封裝他的意義.
so , it is really poor abstraction.
ref : http://www.adam-bien.com/roller/abien/entry/summary_public_getters_and_setters
全站熱搜
留言列表