We are independent & ad-supported. We may earn a commission for purchases made through our links.
Advertiser Disclosure
Our website is an independent, advertising-supported platform. We provide our content free of charge to our readers, and to keep it that way, we rely on revenue generated through advertisements and affiliate partnerships. This means that when you click on certain links on our site and make a purchase, we may earn a commission. Learn more.
How We Make Money
We sustain our operations through affiliate commissions and advertising. If you click on an affiliate link and make a purchase, we may receive a commission from the merchant at no additional cost to you. We also display advertisements on our website, which help generate revenue to support our work and keep our content free for readers. Our editorial team operates independently of our advertising and affiliate partnerships to ensure that our content remains unbiased and focused on providing you with the best information and recommendations based on thorough research and honest evaluations. To remain transparent, we’ve provided a list of our current affiliate partners here.
Software

Our Promise to you

Founded in 2002, our company has been a trusted resource for readers seeking informative and engaging content. Our dedication to quality remains unwavering—and will never change. We follow a strict editorial policy, ensuring that our content is authored by highly qualified professionals and edited by subject matter experts. This guarantees that everything we publish is objective, accurate, and trustworthy.

Over the years, we've refined our approach to cover a wide range of topics, providing readers with reliable and practical advice to enhance their knowledge and skills. That's why millions of readers turn to us each year. Join us in celebrating the joy of learning, guided by standards you can trust.

What does "Multiple Inheritance" Mean?

By Vanessa Harvey
Updated: May 16, 2024
Views: 6,695
Share

Multiple inheritance, when speaking of object-oriented programming (OOP) languages, is a term that refers to a class that inherits functionality from more than one parent class. The term cannot be fully grasped without understanding what a class is. A very brief definition of a class is a set of programming instructions or code in an OOP language that describes and is the essence of an entity. Classes define all of the properties of an entity and contain all of the methods necessary for manipulating those properties.

Depending on the program that is being coded, there might be a need to write many classes that have things in common but need to remain distinct entities. This is where multiple inheritance comes into play. For example, technological advances that would allow the building of a submarine that could fly like an airplane or an airplane that could submerge like a submarine would produce a hybrid product. That hybrid would have some of the same properties as an airplane has and some of the properties of a submarine, but it would be a unique product or entity. Multiple inheritance would easily allow the hybrid to inherit functionality from an airplane class and functionality from a submarine class at the same time without copying code.

Another way of explaining multiple inheritance is to say that it allows more than one class to act as the base for other classes. There are advantages to using multiple inheritance instead of simply copying code from one or more classes to another. Bugs in programs often take time to be discovered, but when they are discovered, they need to be corrected as soon as possible. If code containing bugs is copied to several classes, programmers must apply the same fix to every copy of the code. When multiple inheritance is employed, however, he or she would have to work with the code of only the original class from which all of the subclasses inherit functionality.

Not all programming languages support multiple inheritance, even if they support object orientation. Some versions of some languages might be claimed to support it when in reality they support inheritance from only two classes. The classes from which other classes inherit functionality are often referred to as "parent" classes or "super classes," and the classes that inherit are called "child" classes or "subclasses." Programmers who are interested in working with classes in this way are strongly advised to first gain a solid knowledge of the basics of classes before attempting to take advantage of the power of multiple inheritance, because mistakes or poor coding practices in the parent class are passed down to the child class.

Share
EasyTechJunkie is dedicated to providing accurate and trustworthy information. We carefully select reputable sources and employ a rigorous fact-checking process to maintain the highest standards. To learn more about our commitment to accuracy, read our editorial process.
Discussion Comments
Share
https://www.easytechjunkie.com/what-does-multiple-inheritance-mean.htm
Copy this link
EasyTechJunkie, in your inbox

Our latest articles, guides, and more, delivered daily.

EasyTechJunkie, in your inbox

Our latest articles, guides, and more, delivered daily.