KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am just experimenting with the references using this code: class A { }; class B { public: B(A& a): m_a(a){} A& m_a; }; int main() { A a; B b(a); B b1 = b; } I was expecting both B b1 = b; to produce a error. Instead when I compile with VS2008 I just get a warning warning C4512: 'B' : assignment operator could not be generated I understand why I am getting this warning. But shouldn't the compiler generating an error for the B b1 = b; statement too? It is like it generated copy constructor but didn't generate assignment operator. Aren't these two inherently linked to one another ? does it makes sense to generate the default implementation for only one of them when the other could not be generated?
Tags (comma-separated)
Save Edits
Cancel