These past few weeks we have learned a few different topics. One of them being Inheritance. I feel this is a good way to reduce the replication of code. It saves space and and makes a denser final product keeping the solution tight.
A good example of this was shown through the weeks lab. If you have a main class which holds all the main attributes of something that is Motorized other things can extend of this. For example a car and a motorcycle both contain a motor but they also have unique attributes from on another. So in this case they would both inherit the motor attributes, but the car would have something else specified within it such as four wheels, while the motorcycle would only have two. This example really made the idea of inheritance clear for me.
After doing many examples I have found inheritance to be a great tool for object oriented programming. As the days go on I will go deeper into it and other corner cutting efficiency techniques.
No comments:
Post a Comment