class String {
public:
String (const char* s);
~String () { delete [] text; }// destructor
........
private:
char* text;
int len;
};
The ~String member function, specified completely above
as "inline" code, releases the space pointed to by text.
In C++, two functions in the same scope may have the same
name. When functions are overloaded this way, the C++
compiler determines which one is needed by examining the
function's arguments. For example, suppose that two
prototypes of the function fooexist in the same scope
|