Quick A: Because they reduce code duplication, and so make code more readable and maintainable.
Recently on SO:
Why did C++11 introduce delegating constructors?
I cannot understand what the use is of delegating constructors. Simply, what cannot be achieve without having delegating constructors?
It can do something simple like this
class M { int x, y; char *p; public: M(int v) : x(v), y(0), p(new char [MAX]) {} M(): M(0) {cout<<"delegating ctor"<<endl;} };But I don't see it, is it worth introducing a new feature for such a simple thing? May be I couldn't recognize the important point. Any idea?
Add a Comment
Comments are closed.