/#multiple inheritance#php#web development
When I first wrote about my hacky TypeScript multiple inheritance implementation that destroyed a codebase, I included a small (emphasis on small) section about multiple inheritance in C++, mostly as a joke about how complicated my TypeScript solution was becoming. I was, however, unaware of PHP’s approach to the concept, so I thought I should write an addendum to that piece. PHP, while primarily functional, does boast object-oriented capabilities that have only improved over time. One of these (added in PHP 5.4!) is Traits, which allow you to compartmentalize code into modules added arbitrarily to classes. Traits are essentially small Read More
/#angular#multiple inheritance#web development
This is not a tutorial; please don’t do this. A Brief Primer on Inheritance A common school of thought among programmers is to reduce repetition wherever possible. Usually, this is a good idea, as if I need to change something, I only need to change it in one place. We usually accomplish this using inheritance, like this simple example: This way, both an instance of Animal and an instance of Dog have the name property, but Dogs also have the bark method. If we need to later add a property to both Animals and Dogs, we can just add it Read More