Re:A Square Is Not A Rectangle
by vlisivka on Monday September 14, 2009 @04:54PM
(#822602)
If you use setFoo() and getFoo() then you are not using OOP at all.
Encapsulation is simple thing - just write setters and getters for all your internal data and you done. ;-)
PS.
«If the classes are immutable, there is no problem with this state of affairs. Circles satisfy all invariants of ellipses; and an (immutable) circle can be used in any context where an immutable ellipse is expected.»
Encapsulation is simple thing - just write setters and getters for all your internal data and you done. ;-)
PS.
«If the classes are immutable, there is no problem with this state of affairs. Circles satisfy all invariants of ellipses; and an (immutable) circle can be used in any context where an immutable ellipse is expected.»