Original Post
Consider: class Test { public: Test& operator=( const Test& t ) { cout << "Assignment\n"; m_Val = t.m_Val; return( *this ); } int m_Val; }; void func( Test t ) { cout << "func: " << t.m_Val << "\n"; } void main() { Test T1; T1.m_Val = 5; Test T2 = T1; //assignment operator is not called here but members are copied func( T1 ); //assignment operator not called, members are copied T2 = T1; //assignment operator called } Why is it for the case of Test T2 = T1 the assignment operator does not get called? How do we fix this?