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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T10:09:53+00:00 2026-05-24T10:09:53+00:00

Question 1> what does the following code meaning and what the order of assignment

  • 0

Question 1> what does the following code meaning and what the order of assignment is?

ClassName a1, a2, a3;
a1 = a2 = a3;

Does it mean to First assign value of a3 to a2 and then assign ?? to a1.

Question 2> what does the following code meaning?

ClassName a1, a2, a3;
(a1 = a2) = a3;

Question 3>
Given a class as follows:

class A
{
   ...
}

What operators have to be defined in order to support the following operation?

A a1, a2, a3;
(a1 = a2) = a3;
  • 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-24T10:09:54+00:00Added an answer on May 24, 2026 at 10:09 am

    Question 1

    This:

    a1 = a2 = a3;
    

    is equivalent to this:

    a1 = (a2 = a3);
    

    For primitive types, or for PODs, this is equivalent to:

    a2 = a3;
    a1 = a2;
    

    For user-defined types, it’s equivalent to:

    a1.operator=(a2.operator=(a3));
    

    If you don’t define your own overloads of operator=, then this will be the same as for the primitive types.

    Question 2

    This:

    (a1 = a2) = a3;
    

    only works for user-defined types. It is equivalent to:

    a1.operator=(a2).operator=(a3);
    

    If you use the compiler-provided operators, then this is equivalent to:

    a1 = a2;
    a1 = a3;
    

    Question 3

    No operators have to be defined, as the compiler provides a copy-assignment operator implementation if you don’t write your own.

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

Sidebar

Related Questions

As the question depicts, what does the following code mean? public void blabla (bool?
Similar to this question , after running the following code the browser dialog does
Question says it all. Does anyone know if the following... size_t div(size_t value) {
Can anyone help me with a Javascript question, please? Why does the following code
the following code will help me illustate my question to you directly: #include<iostream> class
I'm sure this is a stupid question, but why does the following code not
The following code throws a ClassCastException. The collection in question actually does hold ArrayList<String>
As the title says. Related to this question. Why does the following code not
The following code gets the first type parameter class declared generically in the interface
The following piece of C# code does not compile: public class A { public

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.