So our main topic, which is inheritance, and we know inheritance in the real world. You have parents. You have your descendants, you have ancestors. And you get the characteristics of. The ancestors. You derive from the ancestors. The inheritance mechanism is a means for deriving new classes from existing classes. The existing classes are called base classes. It reuses the existing code which eliminates. the, the need to test and develop new code. That's one of the reasons that it's important. Typically the derived class adds more information. It modifies behavior for example. So that by deriving point from duo, we added a length calculation. And then the hierarchy of related types created can share code and interface. So they can, you can develop larger and larger systems and keep the code fairly tight. We're allowed in C++ to do both single inheritance and multiple inheritance. some languages typically only allow single inheritance, but in C++, a derived class can derive from multiple classes. Here's single inheritance. Let's say we have the notion of a credit card, but there are different kinds of credit cards. And each might have some different features. So we might decide to derive from some prototype credit card. And then have some different characteristic of the derived. Types of credit cards. Where they each have a different scheme. In multiple inheritance, we might have two separate kinds of issues. Like, a mail where we have characteristics of mail, and we also have phones, which have characteristics of phones. And then the new thing might be phone mail. So, we get a derived class that has as its parenthood the features of mail, the features of phone. So, it combines both things. Both things become available. All of this comes under the heading of taxonomic classification, one of the great breakthroughs in science, was the understanding that things could be lumped into big categories. Where do you see that? You see that for example, in the Periodic table? Until you had the periodic table, chemistry was a pseudoscience. Once you started having a taxonomy you could start seeing things like, oh here are the inert gases, here are the basic metals. And, that taxonomy allowed chemistry to become a science. Same thing with biology. Once you started to have a categorization. Like the idea of vertebrate, invertebrate. The idea of mammal versus reptile. You started to see where there were characteristics that were shared. And that there were root concepts and that you could get a scientific understanding. of very large groups, rather than everything being idiosyncratic information. So we have for example, a concept like mammal, warm blooded, higher vertebrate, nourishing your young with mammary glands, and then we see that within mammal, something like a rodent and an elephant share a lot of characteristics. They both are, even though on the surface, an elephant looks no different than a toad. Yet, an elephant is in effect a very close relative to a mouse; and not such a close relative to a toad. And you can even see that in modern terms with the DNA spec, so that even would emphasize it more, more modern biology. Mouse is a mammal, elephant is a mammal. That's a way to get a characterization. A characterization allows sharing. Remember, software reuse, sharing. Same thing with a taxonomy. So that's what we're doing when we build in an object-oriented fashion. When we build type hierarchies, we're building something that lets us share, and when we want to build something in a big system. That sharing gets to be very, a very powerful asset. In C++ terms, classes such as elephant and mouse derive from a base class mammal. There is terminology for this. An elephant is a mammal. It describes a relationship. It describes a typing relationship. On the other hand, the circus might have elephants. The object circus might have members that are type elephant, but a circus is not a kind of elephant. An elephant is not a kind of circus, so that's a very different relationship, in the class Circus. There's a HASA relationship. It's a subpart relationship. So here's a quiz to see if, if you get this little terminology. Again, it's worth reading up on the basics of object orientation. That was an expectation coming into the class. And the question is zoo has what relationship to mammal, cell phone has what relationship to telephone? Platypus ISA mammal? Is that true or false? Zoo HASA Mammal, it's much like circus might have an elephant. It's best expressed as a member. But CellPhone ISA a telephone. There's a relationship that's best expressed by public inheritance. By the way, you might if you wanted to go and build a cell phone, you might say most modern cell phones, are cameras. So all of a sudden you could build the modern cell phone if you wanted to build it in software with multiple inheritance. Cell phone is also a personal digital assistant, PDA. Keeps your calendar. So it's also in many instances today a fairly general computer. So cellphone could give rise to, if you want, in reuse terms, to effectively using multiple inheritance. So we're going to stay away from multiple inheritance. There's a lot of trickiness in multiple inheritance. Platypus ISA mammal. That is true. Platypus is a semiaquatic mammal. There's a platypus. Gave me an excuse to get that picture off of the Wikipedia.