Virtual Inheritance Doubt

In my project there is a need to for multiple inheritances and I have figured out that i need to inherit base classes virtually. The code that I have works fine, but I would like to know in particular what happens internally during inheritance.

For the declaration of class H do i need to use the keyword 'virtual' before classes D and F? What are the variables contained in class H after inheriting D and F and how many instances of the same variables would be in H?

This is a pretty rough hierarchy. There is still one ambiguity because you do not virtually inherit B in D and F, so there will be two instances of B in H. If you fix that, then H will have one copy of each class all the way up to A.

But the purpose of using virtual inheritance is to avoid ambiguity while inheriting from multiple base classes

Right. Virtual inheritance is kind of like inheriting a reference to a class instead of the class itself. All child classes use the reference instead of a separate copy and there is no ambiguity because there are no copies, just the original.