Back
Close

quiz 70

Anonymous
915 views
#include <iostream>
struct A
{
A(int& var) : r(var) {}
int &r;
};
int main(int argc, char** argv)
{
int x = 23;
A a1(x);
A a2 = a1;
a2 = a1;
return 0;
}
/**
main.cc: In function 'int main(int, char**)':
main.cc:17:9: error: use of deleted function 'A& A::operator=(const A&)'
a2 = a1;
^~
main.cc:2:8: note: 'A& A::operator=(const A&)' is implicitly deleted because the default definition would be ill-formed:
struct A
^
main.cc:2:8: error: non-static reference member 'int& A::r', can't use default assignment operator
**/
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.
Go to tech.io
codingame x discord
Join the CodinGame community on Discord to chat about puzzle contributions, challenges, streams, blog articles - all that good stuff!
JOIN US ON DISCORD
Online Participants