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 7778689
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T18:27:39+00:00 2026-06-01T18:27:39+00:00

I am studying C++ now. I am trying to study it from this link

  • 0

I am studying C++ now. I am trying to study it from this link. Here in the 10th chapter, when I study about operator overloading, in an example program “*this” is returned as a constant reference. Here it is

Here in this program we are dereferencing the current object using “*this” and returning the value means the current Counter object as constant reference.

So when I do like this:

Counter a = ++i;

is the current object assigned to a constant reference and the value of the constant reference is copied to the new object created using default copy constructor ?

  • 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-01T18:27:40+00:00Added an answer on June 1, 2026 at 6:27 pm

    When you write

    Counter a = ++i;
    

    You’re simply copying from the const Counter & being returned from the function. What you’re doing is equivalent to (from the point of view of a):

    const Counter & ref = ++i;
    Counter a = ref;
    

    As long as you define a to be a Counter object, it will be created as a brand new Counter object (Or you will get a compiler error if the copy-constructor is not accessible).

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

Sidebar

Related Questions

I'm studying C# right now and currently learning threading. Here is a simple example
I'm studying ARC. And now about zeroing weak pointer. OK I understood all the
I'm studying C++ right now, coming from a background in Python, and I'm having
I am studying Java concurrency right now. I have a question about synchronized and
I'm studying for the 70-536 exam and now I'm checking the lesson about converting
Im new on C# and now im studying enums and im having this problem
Now i am studying how to fetch data from website as fast as possible.
I've been studying PHP for a while now, and Ajax for about a month
I've been studying php for about 6 months now and want to start learning
Hey guys, I'm studying for a midterm right now and am working on trying

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.