home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / cplus / 13076 < prev    next >
Encoding:
Text File  |  1992-08-30  |  1.0 KB  |  52 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!gatech!ncar!csn!teal.csn.org!sullivan
  3. From: sullivan@teal.csn.org (Steve Sullivan)
  4. Subject: beginner's question ...
  5. Message-ID: <Bttw5G.85M@csn.org>
  6. Sender: news@csn.org (news)
  7. Nntp-Posting-Host: teal.csn.org
  8. Organization: Colorado SuperNet, Inc.
  9. Distribution: na
  10. Date: Mon, 31 Aug 1992 03:24:52 GMT
  11. Lines: 39
  12.  
  13.  
  14. Here's a beginner's question ... when I compile the following
  15. file with gcc 2.2.2 on Sunos 4.1.1, I get:
  16.    > g++ -c testd.cc
  17.    testd.cc: In function `int  main ()':
  18.    testd.cc:9: template for method `print' doesn't match any in class `QI<int>'
  19.  
  20. Yet it looks ok to me.  Where am I going wrong???
  21. Any help would be much appreciated.
  22. Many thanks -
  23.  
  24. Steve Sullivan
  25. sullivan@mathcom.com
  26.  
  27. =========== cut here =============
  28. template <class T>
  29. class QI {
  30. public:
  31.   QI(); 
  32.   void print() const;
  33. private:
  34.   T item;
  35.   QI *next;
  36.   };        // this is line 9
  37.  
  38.  
  39.  
  40. template <class T>
  41. QI<T>::QI() {}
  42.  
  43.  
  44. template <class T>
  45. void QI<T>::print() const {};
  46.  
  47.  
  48. main () {
  49.    QI<int> alpha();
  50.    }
  51. =========== cut here =============
  52.