3 ms·
And you can replace it with a virtual property in the future (changing the underlying implementation) without breaking anything. And user code ends up simpler a
by Tloewald 12y ago
And you can replace it with a virtual property in the future (changing the underlying implementation) without breaking anything. And user code ends up simpler and more readable too:
foo.baz += foo.bar;
vs.
foo.setBaz( foo.getBaz() + foo.getBar() );
- HanyouHottie 12y agoThat example reminds me of this recent post on The Old New Thing: http://blogs.msdn.com/b/oldnewthing/archive/2014/08/14/10549885.aspx http://blogs.msdn.com/b/oldnewthing/archive/2014/08/14/10549... Interesting behavior.
- Tloewald 12y agoOf course, setters don't protect you from this either.