Hi Michael,
On Sat, Mar 11, 2017 at 3:36 PM, Michael Vostrikov <
[email protected]> wrote:
>
> class Square variant of Rectangle
> {
> public function __match()
> {
> if ($this->width != $this->height) {
> return ['width' => 'Width and height have to be the same'];
> }
>
> return true;
> }
> }
>
DbC allows this kind of validation at development time.
I suppose you would like to check requirement at runtime always.
It would be nice to have feature, but I think
something like __requrie()
is better name for the method.
IMO, C# like getter/setter is better though.
http://stackoverflow.com/questions/11159438/looking-for-a-short-simple-example-of-getters-setters-in-c-sharp
Regards,
--
Yasuo Ohgaki
[email protected]