Abraxas/Meyers: Effective C++  Home  Table of Contents

Module - m11.html

ABRAXAS SOFTWARE - CodeCheck Meyers: Effective C++ Test-Suite

Meyers: Effective C++ Test Suite for Module - m11.cpp

// Item 11: Handle assignment to self in operator=. 53

class Widget {
public:
	Widget();
	~Widget();
 Widget& operator=( const Widget&  ) ;
private:
	Widget *pw;
};
 Widget& operator=( const Widget& rhs )



Function Name: operator=()

 {	
	 delete pw;			// rule 11, warn if first line
	 return *this;		
 }

Abraxas/Meyers: Effective C++  Home  Table of Contents

ABRAXAS SOFTWARE - CodeCheck Meyers: Effective C++ Test-Suite