News for hackers. Stuff that matters.
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.»

Re:A Square Is Not A Rectangle by drp on Monday September 14, 2009 @05:53PM (#822691)
I agree. You can't have a rectangle with a null width, so why should you be able to instantiate one?