google / styleguide

Style guides for Google-originated open-source projects
https://google.github.io/styleguide/
Apache License 2.0
37.01k stars 13.28k forks source link

FYI: the diamond problem is solved! #781

Closed joortcom closed 1 year ago

joortcom commented 1 year ago

@pwnall

I'm reading: https://github.com/google/styleguide/blob/gh-pages/cppguide.html esp about the multiple inheritance part.

And I just want to let you know: the diamond problem is solved! please check here:

https://github.com/joortcom/DDIFI

The diamond problem solved! Using virtual property to decouple the data dependency of the subclass on the superclass, as a clean and general solution to multiple inheritance.

If the company are interested, I can goto Google and give a presentation talk about the design pattern.

Regards.

tituswinters commented 1 year ago

IIUC, that is a solution if your tool is used AND if everyone is doing that consistently from the beginning.

joortcom commented 1 year ago

Previously people are haunted by the diamond problem, because there was no clean solution. That's why people and most programming style guide suggested avoiding MI as much as possible.

But, now we have a clean and general solution (I just invented this design pattern early this year). Then people can start using it: "better late than never" :-)

BTW: it's just a design pattern, can be used in a number of mainstream programming languages, no additional "tool" is needed.