Deadly Diamond of Death


The designers of Java avoided multiplhe inheritance. Replacing it is multiple conformance to interfaces. In Java, there is a structure called an “Interface”. A Java interface is almost identical to a C++ class that has nothing but pure virtual functions. In Java you cannot inherit from more than one base class. However you can “implement” more than one interface.

This UML  diagram shows four classes arranged in the diamond structure that creates the need for virtual inheritance. Both of the classes B and C inherit from class A. D multiply inherits from both B and C. Two problem arise from this. First, which implementation of the ’f’ function does D inherit? Should it inherit B::f() or C::f(). In C++ the answer turns out to be neither. D::f() must be declared and implemented. This eliminates the ambiguity, and certainly this simple rule could have been adopted in Java.

Why I chose C++


I’m starting to study the Programming Language C++. I’m a C programmer, so I feel that I can improve my programming skills studying C++. The C++ syntax is similar to C, providing for me a facility.

The book which i’m reading: The Programming Laguage C++.

I’ll transcribe some main points the first chapter about C++, which I think most interesting.

I(Bjarne) invented C++, wrote its early definitions, and produced its first implementation. I chose and formulated the design criteria for C++, designed all its major facilities, and was responsible for the processing of extension proposals in the C++ standards committee.Clearly, C++ owes much to C [Kernighan,1978]. Except for closing a few serious loopholes in the type system (see Appendix B), C is retained as a subset. I also retained C’s emphasis on facilities that are low-level enough to cope with the most demanding systems programming tasks.

C in turn owes much to its predecessor BCPL [Richards,1980]; in fact, BCPL’s // comment convention was (re)introduced in C++. The other main source of inspiration for C++ was Simula67[Dahl,1970] [Dahl,1972]; the class concept (with derived classes and virtual functions) was borrowed from it. C++’s facility for overloading operators and the freedom to place a declaration wherever a statement can occur resembles Algol68 [Woodward,1974].

C++ is used by hundreds of thousands of programmers in essentially every application domain.This use is supported by about a dozen independent implementations, hundreds of libraries, hundreds of textbooks, several technical journals, many conferences, and innumerable consultants.Training and education at a variety of levels are widely available.

C++ is widely used for teaching and research. This has surprised some who – correctly – point out that C++ isn’t the smallest or cleanest language ever designed. It is, however:

clean enough for successful teaching of basic concepts,
– realistic, efficient, and flexible enough for demanding projects,
– available enough for organizations and collaborations relying on diverse development and
execution environments,
comprehensive enough to be a vehicle for teaching advanced concepts and techniques, and
– commercial enough to be a vehicle for putting what is learned into non-academic use.

C++ is a language that you can grow with.