News for hackers. Stuff that matters.
Re:Inheritance Often Doesn't Make Sense by mcbits on Sunday March 18, 2018 @02:49AM (#16610744)
They wanted an example of inheritance. Something like:

You need an office. You could create a new office from scratch, or you could also just put a desk in a room in your house and give it a unique address like "Suite 1". Now it's both a Room and a HomeOffice.

But if your HomeOffice exposes a method BuildWall(), which mutates the office into a collection of two Rooms, then it would stop fitting the definition of a Room after calling that method.

I don't know if there are different tax consequences for one-room vs. multi-room home offices, but that's one area where the distinction could at least conceivably be significant enough to affect whether you'd prefer to build a separate office or inherit the old room, or maybe just rent an existing office from a third party.

There are no comments on this comment yet.