home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!gatech!ncar!csn!teal.csn.org!sullivan
- From: sullivan@teal.csn.org (Steve Sullivan)
- Subject: beginner's question ...
- Message-ID: <Bttw5G.85M@csn.org>
- Sender: news@csn.org (news)
- Nntp-Posting-Host: teal.csn.org
- Organization: Colorado SuperNet, Inc.
- Distribution: na
- Date: Mon, 31 Aug 1992 03:24:52 GMT
- Lines: 39
-
-
- Here's a beginner's question ... when I compile the following
- file with gcc 2.2.2 on Sunos 4.1.1, I get:
- > g++ -c testd.cc
- testd.cc: In function `int main ()':
- testd.cc:9: template for method `print' doesn't match any in class `QI<int>'
-
- Yet it looks ok to me. Where am I going wrong???
- Any help would be much appreciated.
- Many thanks -
-
- Steve Sullivan
- sullivan@mathcom.com
-
- =========== cut here =============
- template <class T>
- class QI {
- public:
- QI();
- void print() const;
- private:
- T item;
- QI *next;
- }; // this is line 9
-
-
-
- template <class T>
- QI<T>::QI() {}
-
-
- template <class T>
- void QI<T>::print() const {};
-
-
- main () {
- QI<int> alpha();
- }
- =========== cut here =============
-