KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
In the following, would there be a temporary object created before const reference is used to a non-const object? const int y = 2000; const int &s = y // ok, const reference to const object. int x = 1000; const int &r = x; // any temporary copy here? If no then, how does this work? const int z = 3000; int &t = z // ok, why can't you do this?
Tags (comma-separated)
Save Edits
Cancel