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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:48:12+00:00 2026-05-26T00:48:12+00:00

Consider the following declarations: Object *a; Object *b; There are two ways of assigning

  • 0

Consider the following declarations:

Object *a;
Object *b;

There are two ways of assigning a to b, by value or by reference:

a = b; // by reference
*a = *b; // by value

If the declarations are:

Object &a;
Object &b;

(I know its not possible to declare them without initializing them, its just to show the types)

There are two ways of assigning a to b too, just like with pointers, by reference or by value.
Which one this code:

a = b;

is going to do? Is it possible to make it do the opposite one? (with a different syntax?)

  • 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-26T00:48:12+00:00Added an answer on May 26, 2026 at 12:48 am

    That overwrites the object referred to.

    And no, it is not possible to rebind a reference so that it refers to a different object. If you need to do that, use a pointer instead.

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

Sidebar

Related Questions

Consider the following two structures: template <typename T> struct duplet{ QString str; T value;
Consider the following code: struct Foo { }; struct Bar { explicit Bar(const Foo&)
Possible Duplicate: Is there some ninja trick to make a variable constant after its
Consider the following: volatile uint32_t i; How do I know if gcc did or
Consider the following declarations of a std::vector (taken from cplusplus - EASTL has the
Consider the following snippet: struct Foo { static const T value = 123; //Where
Consider the following header file, there are 2 Delegate Protocols declaration : NSSpeechSynthesizerDelegate and
Consider following situation: there is ComboBox and a filter TextBox, then user types a
Consider following two tables: tag_names (tag_id, tag_name) tag_links (tag_id, image_id) An image can have
I have the following homework question: Consider the following declarations and answer the question.

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.