home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky gnu.g++.help:1592 comp.lang.c++:17994
- Newsgroups: uw.dcs.general,gnu.g++.help,comp.lang.c++
- Path: sparky!uunet!stanford.edu!agate!doc.ic.ac.uk!warwick!dcs.warwick.ac.uk!jas
- From: jas@dcs.warwick.ac.uk (Jason Morris)
- Subject: Deriving C++ Templates
- Message-ID: <1992Dec15.160544.26065@dcs.warwick.ac.uk>
- Sender: news@dcs.warwick.ac.uk (Network News)
- Nntp-Posting-Host: quartz
- Organization: Department of Computer Science, Warwick University, England
- Date: Tue, 15 Dec 1992 16:05:44 GMT
- Lines: 11
-
-
- I have a C++ class, Matrix, and from this I derived a class, Vector, which
- is simply a 1-D Matrix. The problem was that I could only have a Matrix of,
- say floats, but I wanted something more flexible that could hold anything. So
- I changed Matrix to be a template with the type of element given as the
- template arguement. That works fine.
- However, I am now having problems in deriving Vector. Is it actually
- possible to use a template as a base class? Or are parameterised types and
- inheritance mechanisms mutually exlusive?
-
- Jas.
-