Declaring a member function with the const keyword specifies that the function is a "read-only" function that does not modify the object for which it is called.
struct SockAddrIn : public SOCKADDR_IN {
public : ...
bool IsEqual(const SockAddrIn& sin) const; //A read-only function, IsEqual cannot modify any data members or call any member functions that aren't constant. void SetAddr(SOCKADDR_IN* psin) { memcpy(this, psin, Size()); } //A write function, cannot be const
... };
|