Home
Blogs
Questions
Jobs
Monetize

Home

About Us

Blogs

Questions

Jobs

Monetize

Post Job

banner

Questions about const-reference

Read more about const-reference

python (12.9k questions)

javascript (9.2k questions)

reactjs (4.7k questions)

java (4.2k questions)

java (4.2k questions)

c# (3.5k questions)

c# (3.5k questions)

html (3.3k questions)

Questions - const-reference

Understanding const reference in assignment when constructing object

Today I see this piece of code and I'm wondering to know what it is exactly doing this const reference in an assignment where a new object is created. (I don't know how to name this kind of assignment...
test-img

cbuchart

c++

c++14

variable-assignment

const-reference

Votes: 0

Answers: 2

Latest Answer

From std::string::c_str's documentation, it returns: a pointer to an array that contains a null-terminated sequence of characters (i.e., a C-string) representing the current value of the string objec...
test-img

Jason

Difference between ordinary parameter, reference parameter and const reference parameter passed by ordinary object and object created temporary

Since I'm a beginner in c++, some questions don't quite understand. This question came across by accident while I was reading C++ primer 5th. I have a Cat class with 3 different constructors(named by...
test-img

黄柏禧

c++

parameters

reference

constants

const-reference

Votes: 0

Answers: 1

Latest Answer

It's pretty simple: ctor 1 receives the argument by copy (pass by value); ctor 2 receives the argument by non-const lvalue reference, so it only supports non-const lvalues. ctor 3 receives argument b...
test-img

digito_evo

Posts

Questions

Blogs

Jobs

The ultimate platform for coders and IT specialists

About

  • Company
  • Support

  • Platform

  • Terms & Conditions
  • Privacy statement
  • Cookie policy
  • Cookie option
  • OnlyCoders © 2025  |  All rights reserved