Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7732537
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T06:45:18+00:00 2026-06-01T06:45:18+00:00

In C++11, what is meant by inheriting the constructor? If it is what i

  • 0

In C++11, what is meant by inheriting the constructor? If it is what i think it is (Base class constructor is brought in the scope of the derived class), what are its implications on my code? What are the applications of such a feature?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T06:45:20+00:00Added an answer on June 1, 2026 at 6:45 am

    Inheriting Constructors means just that. A derived class can implicitly inherit constructors from its base class(es).

    The syntax is as follows:

    struct B
    {
        B(int); // normal constructor 1
        B(string); // normal constructor 2
    };
    
    struct D : B
    {
        using B::B; // inherit constructors from B
    };
    

    So now D has the following constructors implicitly defined:

    D::D(int); // inherited
    D::D(string); // inherited
    

    Ds members are default constructed by these inherited constructors.

    It is as though the constructors were defined as follows:

    D::D(int x) : B(x) {}
    D::D(string s) : B(s) {}
    

    The feature isn’t anything special. It is just a shorthand to save typing boilerplate code.

    Here are the gory details:

    12.9 Inheriting Constructors

    1) A using-declaration that names a constructor implicitly declares a
    set of inheriting constructors. The candidate set of inherited
    constructors from the class X named in the using-declaration consists
    of actual constructors and notional constructors that result from the
    transformation of defaulted parameters as follows:

    • all non-template constructors of X, and
    • for each non-template constructor of X that has at least one parameter with a default argument, the set of constructors that
      results from omitting any ellipsis parameter specification and
      successively omitting parameters with a default argument from the end
      of the parameter-type-list, and
    • all constructor templates of X, and
    • for each constructor template of X that has at least one parameter with a default argument, the set of constructor templates that results
      from omitting any ellipsis parameter specification and successively
      omitting parameters with a default argument from the end of the
      parameter-type-list
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am inheriting a fairly large code base which unfortunately exhibits a lot of
Given the code require 'gdata' class Contacts class Gmail < Base What does it
Namespaces in .NET are meant to Group logical pieces of code together Prevent conflicts
I'm inheriting some html/php code. I've installed apache and php on my windows box.
I am trying to stop a class from being able to convert its 'this'
I have the following code: trait A { import org.somepackage.C._ } class B extends
Lets say I have a class A.java , When I will execute a constructor
Inheriting code from other developers has made me a firm believer in keeping as
I wish to declare a new dojo class inheriting from an existing dojo class,
I have a class Movement inheriting from TimeBlock. TimeBlock is provided for me and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.