prog.cpp: In function ‘int main()’:
prog.cpp:22:7: error: use of deleted function ‘MyClass1& MyClass1::operator=(const MyClass1&)’
a1 = a2;
^~
prog.cpp:4:7: note: ‘MyClass1& MyClass1::operator=(const MyClass1&)’ is implicitly deleted because the default definition would be ill-formed:
class MyClass1
^~~~~~~~
prog.cpp:4:7: error: passing ‘const string {aka const std::__cxx11::basic_string<char>}’ as ‘this’ argument discards qualifiers [-fpermissive]
In file included from /usr/include/c++/6/string:52:0,
from /usr/include/c++/6/bits/locale_classes.h:40,
from /usr/include/c++/6/bits/ios_base.h:41,
from /usr/include/c++/6/ios:42,
from /usr/include/c++/6/ostream:38,
from /usr/include/c++/6/iostream:39,
from prog.cpp:1:
/usr/include/c++/6/bits/basic_string.h:565:7: note: in call to ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’
operator=(const basic_string& __str)
^~~~~~~~