Virtual inheritance
Virtual inheritance is a technique to solve the problem of the diamond of death that can arise when via multiple inheritance you can inherit the same base class several times.
For example, suppose you have a class Person, and two derived classes of it: Student and Employee. Now you can have a class StudentWorker that inherits from Student AND from Employee. So this class inherits twice the class Person. But in reality there should be only one Person, with a unique name and date of birth, etc... You can achieve this with virtual inheritance.
class Person {...};
class Student: public virtual Person {...};
class Employee: public virtual Person {...};
class StudentWorker: public Student, public Employee {...};
Disinheritance
The idea of disinheritance is to get rid of some inherited member. The problem is that disinheritance would infringe the Liskov substitution principle and break core assumptions about derived objects. This is certainly why it is not supported by modern mainstream OOP languages as far as I know (for example Java). (Edit: therethere seems however to exist a patent for a runtime implementation of the concept)
There are several strategies that can help to achieve the underlying need:
- A usual workaround is to override the function to be desinherited, and trigger an exception in case it is called.
- Another approach is to decompose what is inherited and (over)use multiple inheritance in combination with a mixin architecture
Some will claim that the need for disinheritance is the symptom of a design flaw. Alternatives to be considered:
- private inheritance, to hide the inheritance downstream the inheritance hierarchy.
- composition, using some proxy members to address the composed object frequently does address such (des)inheritance problems, especially when the principle of composition over inheritance is not rigorously enforced.
Similarities
So in general, and in absence of an authoritative definition of the term, disinheritance has nothing to do with virtual inheritance.
However, the virtual inheritance can somehow be analyzed as a way of getting rid of multiple redundant base classes. So I can imagine that in this very specific context, some people could consider it as a kind of disinheritance. Personally, I think this terminology would be abusive here, because it's not so about getting rid of the inheritance, but "factorizing" (in the mathematical sense) redundant base elements into a common base element.