\documentstyle[12pt]{article}
\oddsidemargin 0.25in
\topmargin -0.5in
\textheight 8.5in
\textwidth 6.25in
\newcommand{\doublespace}{
   \renewcommand{\baselinestretch}{1.5}
   \large\normalsize}
\newcommand{\singlespace}{
   \renewcommand{\baselinestretch}{1.0}
   \large\normalsize}
\newcommand{\be}{\begin{equation}}
\newcommand{\ee}{\end{equation}}

\begin{document}
\begin{verbatim}
  #include <iostream.h>
  #include <string.h>
  class Student
  {
   public:
     Student(char *pName = "no name")      //constructor  
                                           //("no name" is default value)
       {
       strcpy(name, pName);
       noOfStudents++;             
       }
     ~Student()                            //destructor (see Lecture 4) 
       {
         noOfStudents--;
       }

      //findName - return student with specified name
        static Student *findname(char *pName);
   private:
     static int noOfStudents;
     static Student *pFirst;
     Student *pNext;
     char name[40];
   };
   int Student::noOfStudents=0;     //Initialize static data member
   Student* Student::pFirst=0;      //Initialize static data member

   //findName- return student with specified name.
   //          Return zero if no match.
   Student* Student::findName(char *pName)
   {
     //loop through linked list...
     for(Student *pS=pFirst; pS; pS = pS->pNext) 
     {
       //if we find the specified name...
       if(strcmp(pS->name, pName) == 0)
         {
           //then return the object's address
           return pS;
         }
     }
     //otherwise, return a zero (item not found)
     return (Student*)0;              //cast
   }

   int main()
   {
     Student s1("Randy");
     Student s2("Jenny");
     Student s3("Susy");
     Student *pS = Student::findName("Jenny");
     return 0;
   }
\end{verbatim}
No default
object is associated with a static member function. Calling the static
member function with an object doesn't help. For example:
\begin{verbatim}
 //...same as before...
     int main()
   {
     Student s1("Randy");
     Student s2("Jenny");
     Student s3("Susy");
     Student *pS = s1.findName("Jenny");
     return 0;
   }
\end{verbatim}
The {\tt s1} is not evaluated and not passed to {\tt findName()}. Only
its class is used to decide which {\tt findName()} to call.

\end{document}
