[comp.lang.c++] Classes and Subclases at a Uni e.g. in Wiener and Pinson

anthony@batserver.cs.uq.oz (Anthony Lee) (06/16/89)

On page 136 of "An Intrdouction to Object-Oriented Programming and C++"
by Wiener and Pinson there is a function definition that looks like this:

static char *strsave(char* s) // Why static char * ????
{
  char *p;
  extern char *malloc();  //  Why ????
  p = new char[ strlen(s) + 1];
  strcpy(p, s);
  return( p );

}

class data_rec
{
  private:
    char* last_name;
  .
  .
  .
  public:
    data_rec();
    void insert_last(char* ln);
    {
      last_name = strsave( ln );
    }
}
  .          
  .
  .
  .
class student : public data_rec
{
  private:
   .
   .
   .

My question is why strsave have to return a static char pointer ?
And what's the extern char *malloc() declaration for ?

Thanks in advance
Anthony

Anthony Lee (Humble PhD student) (alias Doctor(Time Lord))
ACSnet:	anthony@batserver.cs.uq.oz	TEL: (07) 3712651
					     (07) 3774139 (w)
SNAIL: 243 Carmody Rd, St Lucia, 4067 Australia