On the one hand, this is good, on the other hand, the current possibilities are so varied that one task can be implemented in dozens of ways. The number of combinations of different approaches generates whole schools and directions on how to write code. How often you should use inheritance? When is the Liskov principle needed?
In this course, we'll take a deep dive into class organization and the concept of inheritance. Let's learn how to build class hierarchies correctly, taking the Liskov substitution principle into account. Then we'll learn why inheritance is almost always a bad way to organize code (but popular because it's easy to do) and why using composition is preferred.
Inheritance involves a lot of new things. Inheritance-specific design patterns start to emerge. Inheritance affects how polymorphic code works, though you don't necessarily need polymorphic code to use it. This should be looked at separately.
Finally, we'll introduce you to a really interesting concept - mixins.
The Hexlet support team or other students will answer you.
A professional subscription will give you full access to all Hexlet courses, projects and lifetime access to the theory of lessons learned. You can cancel your subscription at any time.
Programming courses for beginners and experienced developers. Start training for free
Our graduates work in companies:
From a novice to a developer. Get a job or your money back!
Sign up or sign in
Ask questions if you want to discuss a theory or an exercise. Hexlet Support Team and experienced community members can help find answers and solve a problem.