When to use multiple and multilevel inheritance?

Multiple inheritance is likely to be most useful when you can separate the characteristics of objects into orthogonal sets, in which the characteristics of one set do not depend on the characteristics of other sets. If you can define a class to represent each set of characteristics, you can use multiple inheritance to build complex classes with different combinations of characteristics. We gave a glimpse of how to create such a design by starting to segregate characteristics of flying and ground vehicles, and then noting that certain vehicles, like such as aircraft, can combine both sets of characteristics. Another approach that can be useful for various applications is to create one or more base superclasses, which define common characteristics of subclasses, and a number of mix-in classes, each of which adds a set of orthogonal characteristics. A mix-in class is like an addition, such as chocolate chips or nuts, that might be mixed into an ice-cream base. Another way to think about this approach is to imagine the base class as a noun and the mix-in classes as adjectives that modify or specialize the noun. You can then construct concrete subclasses by using multiple inheritance. For each concrete subclass, one or more mix-in classes typically precede a single base class in the list of superclasses. EXAMPLE : define abstract class () slot identifier :: , required-init-keyword: id:; ... end class ; define abstract class () slot vehicle-id :: , required-init-keyword: id:; ... end class ; define class () slot name :: , init-keyword: name:; ... end class ; define class () slot name :: , required-init-keyword: name:; ... end class ; Multiple inheritance provides several advantages in solving the name problem: 1. We localize in a single class the characteristic of having a name. 2. Subclasses can still customize aspects of the name attribute, such as what that attribute's initial value is, and whether or not it is required. 3. We can give a subclass a name attribute without redefining any of its superclasses. 4. The only subclasses that have a name attribute are those for which that is appropriate. MULTI LEVEL INHERITANCE: I believe this i got this code from others it may helps u: just experiment on it: OK, here's the code n check it: 1195c1195 < IND(s); s // scoped name. Have to use the alias for the base class in the > // global scope to refer to the virtual member function instead. > if (strcmp(intf_name,intf->wrapproxy_uqname()) != 0) { > intf_name = new char[strlen(intf->_scopename())+ > strlen(intf->wrapproxy_uqname())+1]; > strcpy(intf_name,intf->_scopename()); > strcat(intf_name,intf->wrapproxy_uqname()); > } > } > s } > s IND(s); s INC_INDENT_LEVEL(); > IND(s); s