Reduce Repetitive Initialization Code in C++ Applications by Using Delegating Constructors

Posted on Internet.com See other posts from Internet.com
Published on Thu, 05 Aug 2010 04:00:00 +0100 Indexed on 2010/12/21 5:01 UTC
Read the original article Hit count: 413

Filed under:
You're often required to repeat identical pieces of initialization code in every constructor of a class that declares multiple constructors. That's because unlike a few other programming languages, The C++ programming language doesn't allow a constructor to call another constructor of the same class. Luckily, this problem is about to disappear with the recent approval of a new C++0x feature called delegating constructors which are explained in this C++ tutorial.

© Internet.com or respective owner