To define a member function, specify the name of the function preceded by the name of the structure that it belongs to. To implement write(), for instance, write:
ostream& Time::write(ostream& out)
{
// format and print output here
return out;
}
The name of the member function is Time::write; the double-colon operator (::) is called the scope resolution operator and tells C++ where to look for the function.
You can think of the syntax X::Y as meaning “look inside X for Y.” It is important to use the fully-qualified name of the function when implementing it. The code shown below may compile, but C++ thinks you are implementing a regular (or free) function named write() that has no relationship whatsoever to the Time class.
ostream& write(ostream& out)
{
// Error... not a member function
return out;
}