bugl
bugl
HomeLearnPatternsPathsSearch
HomeLearnPatternsPathsSearch

Loading lesson path

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

C++ Multilevel Inheritance

Flash cards

Review the key moves

1/4
Core idea

What is the main idea behind C++ Multilevel 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 ___ (parent) class MyClass { public: void myFunction() { cout << "Some content in parent class." ;
3Order

Put the learning moves in the order that makes the concept easiest to apply.

In the following example, MyGrandChild is derived from class MyChild (which is derived from MyClass ).
A class can also be derived from one class, which is already derived from another class.
Multilevel Inheritance

Multilevel Inheritance

A class can also be derived from one class, which is already derived from another class.

In the following example, MyGrandChild is derived from class MyChild (which is derived from MyClass ).

Example

// Base class (parent) class MyClass { public: void myFunction() { cout << "Some content in parent class." ;
}
};
// Derived class (child) class MyChild: public MyClass {
};
// Derived class (grandchild) class MyGrandChild: public MyChild {
};
int main() {
  MyGrandChild myObj;
  myObj.myFunction();
  return 0;
}

Previous

C++ Inheritance

Next

C++ Multiple Inheritance