c++继承类型
In C++, we have 5 different types of Inheritance. Namely,
在C ++中,我们有5种不同类型的继承。 即
Single Inheritance
单继承
Multiple Inheritance
多重继承
Hierarchical Inheritance
层次继承
Multilevel Inheritance
多级继承
Hybrid Inheritance (also known as Virtual Inheritance)
混合继承(也称为虚拟继承)
C ++中的单一继承 (Single Inheritance in C++)
In this type of inheritance one derived class inherits from only one base class. It is the most simplest form of Inheritance.
在这种继承类型中,一个派生类仅从一个基类继承。 它是最简单的继承形式。
C ++中的多重继承 (Multiple Inheritance in C++)
In this type of inheritance a single derived class may inherit from two or more than two base classes.
在这种继承类型中,单个派生类可以从两个或两个以上的基类继承。
C ++中的层次继承 (Hierarchical Inheritance in C++)
In this type of inheritance, multiple derived classes inherits from a single base class.
在这种继承类型中,多个派生类从单个基类继承。
C ++中的多级继承 (Multilevel Inheritance in C++)
In this type of inheritance the derived class inherits from a class, which in turn inherits from some other class. The Super class for one, is sub class for the other.
在这种继承类型中,派生类从一个类继承,而该类又从其他某个类继承。 一个的超级类,另一个的子类。
C ++中的混合(虚拟)继承 (Hybrid (Virtual) Inheritance in C++)
Hybrid Inheritance is combination of Hierarchical and Mutilevel Inheritance.
混合继承是分层继承和多级继承的组合。
翻译自: https://www.studytonight.com/cpp/types-of-inheritance.php
c++继承类型