double & val = 66.6; //illegal
const double & val = 66.6; //legal
I was just doing some demo programs and came through the above concept but not able to identify what exactly the need of the above concept . what magic exactly const is doing in the second case ?
can anyone please let me know where exactly we can use this concept in real time programming
vikuseth 0 Newbie Poster
Recommended Answers
Jump to PostnVar is converted to a double which results in a temporary variable which is an rvalue. A quick search for rvalues and lvalues yields the following definition:
You can think …
All 3 Replies
deceptikon 1,790 Code Sniper Team Colleague Featured Poster
vikuseth 0 Newbie Poster
Gonbe 32 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.