bugl
bugl
HomeLearnPatternsPathsSearch
HomeLearnPatternsPathsSearch

Loading lesson path

Learn/C++/C++ Classes
C++•C++ Classes

C++ Multiple Inheritance

Flash cards

Review the key moves

1/4
Core idea

What is the main idea behind C++ Multiple Inheritance?

Lesson checks

Practice each idea before moving on

Short Mimo-style checks built from this lesson's code, terms, and sequence.

1Quick choice

Which statement best captures the main point of this lesson?

2Fill blank

Complete the missing token from the example code.

// Base ___ class MyClass { public: void myFunction() { cout << "Some content in parent class." ;

Multiple Inheritance

A class can also be derived from more than one base class, using a comma-separated list:

Example

// Base class class MyClass { public: void myFunction() { cout << "Some content in parent class." ;
}
};
// Another base class class MyOtherClass { public: void myOtherFunction() { cout << "Some content in another class." ;
}
};
// Derived class class MyChildClass: public MyClass, public MyOtherClass {
};
int main() {
  MyChildClass myObj;
  myObj.myFunction();
  myObj.myOtherFunction();
  return 0;
}

Previous

C++ Multilevel Inheritance

Next

C++ Inheritance Access