home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / cplus / 12566 < prev    next >
Encoding:
Text File  |  1992-08-19  |  1.3 KB  |  47 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!charon.amdahl.com!pacbell.com!mips!darwin.sura.net!wupost!m.cs.uiuc.edu!sunb10.cs.uiuc.edu!sparc10.cs.uiuc.edu!pjl
  3. From: pjl@sparc10.cs.uiuc.edu (Paul Lucas)
  4. Subject: Re: A template question
  5. Message-ID: <1992Aug19.163921.25153@sunb10.cs.uiuc.edu>
  6. Keywords: template, BC++ 3.1
  7. Sender: news@sunb10.cs.uiuc.edu
  8. Organization: University of Illinois at Urbana-Champaign
  9. References: <Bt84JC.En0@zorch.SF-Bay.ORG>
  10. Distribution: usa
  11. Date: Wed, 19 Aug 1992 16:39:21 GMT
  12. Lines: 33
  13.  
  14. In <Bt84JC.En0@zorch.SF-Bay.ORG> pchi@zorch.SF-Bay.ORG (Eric Chi) writes:
  15.  
  16. >Hi, I am using Borland C++ 3.1 implementing 2 classes: vector and matrix.
  17. >I have the Vector class defined as a template:
  18.  
  19. >    template <class Type>
  20. >    class Vector
  21. >    {
  22. >    public:
  23. >        Vector( int dim);
  24. >    ...
  25. >    };
  26.  
  27. >Now I tried to define the matrix by utilizing the vector:
  28.  
  29. >    template <class Type>
  30. >    class Matrix: public Vector< Vector< Type>>
  31. >    {
  32. >    ....
  33. >    };
  34.  
  35. >Is this a correct way? Borland C++ seems do not understand the syntax.
  36.  
  37.     class Matrix : public Vector< Vector< Type > >
  38.                             ^
  39.                             |
  40.                         space required
  41.  
  42.     Otherwise '>>' is the right-shift operator.
  43. -- 
  44.     - Paul J. Lucas                University of Illinois    
  45.       AT&T Bell Laboratories        at Urbana-Champaign
  46.       Naperville, IL            pjl@cs.uiuc.edu
  47.