Best Division

Spread Your Knowledge

  • All topics
  • About us
  • Contact us
  • Privacy policy
  • Terms of service
  • Copyright
  • Facebook
  • Twitter
  • Instagram
  • Youtube
  • LinkedIn
  • Pinterest
  • Github
  • Tumblr

© 2026 Best Division

What is a constructor delegation in C++?

C++
Jayant Kumar
Jayant Kumar@jayantkumar314
PublishedJul 24, 2023
UpdatedNov 17, 2026
6 min read

Constructor delegation lets one constructor of a class call another constructor of the same class from its member initialiser list. It was added in C++11 and exists to put shared initialisation logic in a single place instead of repeating it in every overload. It is also known as constructor chaining in other languages.

The syntax is a constructor whose initialiser list contains only a call to another constructor of the same class: Widget() : Widget(0, 0) {}. This article explains the rules, the order of execution, a realistic example, and the pitfalls such as circular delegation and exceptions.

Table of Contents

  • Basic syntax and behaviour
  • Rules you must follow
  • A realistic example with validation
  • Delegation versus default arguments and default member initialisers
  • Exceptions and object lifetime
  • Inheriting constructors as a related feature
  • Frequently Asked Questions
    • Can a delegating constructor also initialise members?
    • Does constructor delegation have a runtime cost?
    • Which C++ standard added delegating constructors?
    • Is constructor delegation the same as calling a base class constructor?
  • Summary

Basic syntax and behaviour

A delegating constructor names the target constructor in its initialiser list, using the class name.

cpp
text

The target constructor runs to completion first, then the body of the delegating constructor runs. Once the target has finished, the object counts as fully constructed.

Rules you must follow

  • A delegating constructor cannot initialise any other member or base class in its initialiser list. The delegation call must be the only entry.
  • Delegation cycles are ill-formed. If A() delegates to A(int) and A(int) delegates back to A(), the program is invalid (compilers are not required to diagnose it, so avoid it).
  • Delegation can only target a constructor of the same class. To call a base class constructor you use the normal base initialiser, which is a different mechanism.
  • Default member initialisers still apply, but only through the target constructor, since only the target initialises members.

A realistic example with validation

Centralising checks in the target constructor means every overload gets them.

cpp

Both short forms funnel into the three-argument constructor, so the validation exists once.

Delegation versus default arguments and default member initialisers

Delegation is not always the best tool. Compare the options.

TechniqueBest forLimitation
Default argumentsTrailing parameters with fixed defaultsDefaults are baked in at the call site, one constructor only
Default member initialisersMembers with a constant default valueCannot validate or compute from arguments
Delegating constructorsDifferent parameter lists sharing setup logicDelegation must be the only initialiser
Private init() functionPre-C++11 codeMembers are default-constructed first, then assigned

A common modern combination is default member initialisers for the simple cases and one target constructor for anything that needs logic.

cpp

Exceptions and object lifetime

An object is considered constructed as soon as any one constructor finishes. With delegation, that means once the target constructor completes, a destructor will run for the object even if the delegating constructor's body then throws.

cpp

If you call Probe p; inside a try block, the output is target done followed by destructor runs. Keep that in mind when the delegating constructor does extra work after the target: it must leave nothing half-built that the destructor cannot handle.

Inheriting constructors as a related feature

Constructor delegation reuses constructors inside one class. A separate C++11 feature, inheriting constructors, reuses a base class's constructors in a derived class with a using-declaration.

cpp

Use delegation when the constructors belong to one class and inheriting constructors when the derived class adds no new data that needs initialisation.

Frequently Asked Questions

Can a delegating constructor also initialise members?

No. If the initialiser list contains a delegation, it can contain nothing else. Put the member initialisation in the target constructor.

Does constructor delegation have a runtime cost?

It adds one extra constructor call, which compilers usually inline. The cost is generally negligible.

Which C++ standard added delegating constructors?

C++11. All current compilers support it in every language mode from C++11 upward.

Is constructor delegation the same as calling a base class constructor?

No. A base constructor call is part of the normal initialiser list, while delegation calls another constructor of the same class and replaces the whole list.

Summary

Constructor delegation, available since C++11, lets one constructor forward to another constructor of the same class so initialisation logic lives in one target constructor. The delegating constructor can have only that call in its initialiser list, cycles are not allowed, and the target completes before the delegating body runs. Combine it with default member initialisers for concise, maintainable classes.

Share