I went to the Steve Dewhurst’s training “C++ Common Knowledge course”. I’ve been having his book quite a long time:
Stephen Dewhurst, “C++ Common Knowledge”
and in general, this training is specifically focused on the topics from it.
Very cool man. It was interesting and accompanied with jokes like that Boost guys just smoke templates etc. I really liked it.
Steve said that C++ is virtually the most that is doing in life. He wrote the compilers, utilities, versed in the standards and now he provides trainings.
I cannot say that I learned something very new - it would be strange since I read his book above from cover to cover and periodically get back to it. Although perhaps one thought I was hooked: the correct implementation of the copy constructor or assignment operator for the class in the hierarchy with a virtual base class having data members is a very complicated task. This clearly violates the principle of independence of the logical levels in the hierarchy of inheritance, as it necessary requires to know exactly from which classes you inherited and how to properly initialize them with multiple inheritance.
The recommendation is as follows: first ask yourself a question: do I need a multiple inheritance here? do I need a virtual multiple inheritance?? but do I need a virtual multiple inheritance with the data in the virtual base class??? And even after long reflection it’s better to say “no”. Personally I don’t have anything against the multiple inheritance. But I don’t really like how it’s implemented in C++. And I don’t really like how it’s done in Java either. I do like how it’s done in Go. In Go the notions of data structures and interfaces are completely separated. Data structures cannot be inherited. They can only implement interfaces. And you can inherit only an interface. Therefore, in principle, it isn’t possible to pick up other people’s data in inheritance but only methods. And no data, no problem in its initialization.
So I just summarize the general recommendations from Steve: