Article View: uw.dcs.general
Article #4Deriving C++ Templates
From: Jason Morris
Date: Tue, 15 Dec 1992 16:05
Date: Tue, 15 Dec 1992 16:05
11 lines
1020 bytes
1020 bytes
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.
Technical Details
Message-ID:
<1992Dec15.160544.26065@dcs.warwick.ac.uk>Path:
arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!agate!doc.ic.ac.uk!warwick!dcs.warwick.ac.uk!jasShow Full Headers
Complete Article Headers
Newsgroups: uw.dcs.general,gnu.g++.help,comp.lang.c++ Path: arc1-ca.pugleaf.net!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