4 ms·
Which is entirely true, and is often the case when performance is a goal - abstractions must be broken. But that is not an argument for or against C++.
by scott_s 14y ago
Which is entirely true, and is often the case when performance is a goal - abstractions must be broken. But that is not an argument for or against C++.
- rumcajz 14y agoI've given an example of the language extension that would solve the problem at the end of the article.
- scott_s 14y agoC++ already allows such a thing using the "curiously recurring template pattern" (http://en.wikipedia.org/wiki/Curiously_recurring_template_pattern http://en.wikipedia.org/wiki/Curiously_recurring_template_pa...), often now called "mixins": class person { protected: int age; int wieght; }; template <class Base> class people: public Base { private: Base *prev; Base *next; }; people<person> plist;
- tedunangst 14y agoYour language extension sounds a lot like the friend keyword.
- scott_s 14y agoThat's what I thought at first, but friend is for when you want class A to be able to view private things of class B. That is, B needs to know ahead of time what A is interested in. He wants B to remain ignorant of what A wants - he wants A to be able to insert new fields into B. But we can accomplish the same thing with mixins.