2017-03-12 23:01 GMT+05:00 Fleshgrinder <p...@fleshgrinder.com>: > As I said already, there is no problem if you just change the direction > of the inheritance. >
Ok, how to inherit Rectangle, Square, Rhomb, all of which are Parallelogram? In your example Rectangle knows restrictions of Square and any Rectangle is instance of Square. It does not match domain model. 2017-03-13 1:40 GMT+05:00 Yasuo Ohgaki <yohg...@ohgaki.net>: > I pasted wrong URL. This URL has better example code. > > https://msdn.microsoft.com/en-us/library/w86s7x04.aspx > > Getters/setters is a good feature, I'd like them to be in PHP, but they should be placed in some classes. What are these classes? We still cannot use all squares as rectangles and some rectangles as squares without questions. And if we already have one $rectangle with w == h, we cannot just use it as square, we must create new object based on $rectangle data.