| 
                  Templates in C++
                   An Introduction for Java Programmers  | 
            
| 
                   
                      
                     Prof. David Bernstein
                       | 
            
| Computer Science Department | 
| bernstdh@jmu.edu | 
               
            
         
            
         Object which makes it
              fairly easy to design generic (though not type-safe)
              classes
        
         
            
         max returns an instance of
              AnyObject and is passed two instances of
              AnyObject, one named a and one named
              b
                     AnyObject is not an actual class,
              it is a "placeholder"
         
            
         FixedSizeCollection:
      FixedSizeCollection:
      
         
            
         #include the source code.h) and
	      implementation (.cpp) files but
                        #include the implementation (.cpp) file
              (which will #include the .h file
              as before).
	    .cpp file can be compiled and linked.
              .h)
              and implementation (.cpp) files for
              template classes/functions -- put everything in the header
              file.
	    .h
              file contains a template so we will use .hpp
              files for this purpose.
              
         
            
         
         
            
         
         
            
         
FixedSizeCollection Template
         
            
         
         
            
         
         
            
         
         
            
         Container class that fixes the type of
              element in a template)
	Row
              class that specializes a Table base class)