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

  • Home
  • SEARCH
  • 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 7408615
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:56:50+00:00 2026-05-29T05:56:50+00:00

In C++ I have a constructor that accepts an object of class descriptor .

  • 0

In C++ I have a constructor that accepts an object of class descriptor. This class has recently grown in size and I need to pass it by reference more. If I pass it by reference into the following ctor will the member still make its own copy given that it is not declared as a reference type?

    descriptor taskedStats;
public:
    CWorkerThread(int ticketNumber, int threadNumber, descriptor taskedStats) :
        _pPaginatableForm(pPaginatableForm), ticketNumber(ticketNumber)
        , threadNumber(threadNumber), taskedStats(taskedStats) {}

or

    descriptor taskedStats;
public:
    CWorkerThread(int ticketNumber, int threadNumber, descriptor &taskedStats) :
        _pPaginatableForm(pPaginatableForm), ticketNumber(ticketNumber)
        , threadNumber(threadNumber), taskedStats(taskedStats) {}
  • 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-05-29T05:56:51+00:00Added an answer on May 29, 2026 at 5:56 am

    The default, or implicit, compiler-supplied copy constructor makes shallow copies of all members and would have the following signature:

    descriptor(const descriptor &other);
    

    so passing a reference to descriptor would be no different to attempting (in C parlance) to pass a copy- they would both in fact just be passed by reference.

    If the member was declared as a reference type then, just as for pointers, its type wouldn’t match in the above, implicit, copy constructor and a reference assignment would be performed, thuse invalidating any attempt to create a local copy in each object.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For my exception class i have a constructor that has multi arguments (...) which
I have a constructor (for an auto generated class) that has 255 paremeters. Using
I have a constructor that has a series of classes and functions within it
I have a constructor that looks like this (in c++): Interpreter::Interpreter() { tempDat ==
I'm working on someone's code and they have a constructor that uses: class qwerty
Is it good practice to have a class constructor that uses default parameters, or
I have a mocked object that is passed as a constructor argument to another
Say you have a Price object that accepts either an (int quantity, decimal price)
I have a method in a class that I need to execute twice asynchronously.
I have a class (let's call it MyService ) that accepts two dependencies in

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.