- Warning 1529: Symbol 'Class::operator=(const Class &)' not first checking for assignment to this
/**
* @brief Copy assignment operator.
*/
-Pinger& Pinger::operator=( const Pinger & )
+Pinger& Pinger::operator=( const Pinger &other )
{
+ // checking for self-assignment (i.e. object1 = object1)
+ if ( &other == this ) {
+ return *this;
+ }
// TODO: Not implemented at all? Then disable it in the class definition
return *this;
}
/**
* @brief Copy assignment operator.
*/
-IcmpMessage& IcmpMessage::operator=( const IcmpMessage & )
+IcmpMessage& IcmpMessage::operator=( const IcmpMessage &other )
{
+ // checking for self-assignment (i.e. object1 = object1)
+ if ( &other == this ) {
+ return *this;
+ }
+
// TODO: Not implemented at all. Fix it or disable it
return *this;
}
/**
* @brief Copy assignment operator.
*/
-IcmpPacket& IcmpPacket::operator=( const IcmpPacket & )
+IcmpPacket& IcmpPacket::operator=( const IcmpPacket &other )
{
+ // checking for self-assignment (i.e. object1 = object1)
+ if ( &other == this ) {
+ return *this;
+ }
+
// TODO: Not implemented at all. Fix it or disable it
return *this;
}
/**
* @brief Copy assignment operator.
*/
-TcpSegment& TcpSegment::operator=( const TcpSegment & )
+TcpSegment& TcpSegment::operator=( const TcpSegment &other )
{
+ // checking for self-assignment (i.e. object1 = object1)
+ if ( &other == this ) {
+ return *this;
+ }
+
// TODO: Not implemented at all. Fix it or disable it.
return *this;
}