Article View: hepnet.lang.c++
Article #13How to construct class member - template object using non-default constructor ?
From: bob
Date: Thu, 01 Dec 1994 15:10
Date: Thu, 01 Dec 1994 15:10
35 lines
1822 bytes
1822 bytes
Hello, All !!!
I have template class with only one constructor, which has parameters
(non-default constructor). I want some object of this class to be a member of
another class, but not a pointer. Here is an example:
template <class T>
class A
{
public:
A (int param);
...
int func (void);
};
class B
{
A<int> a(5); // this doesn't work. What can I do to make it work, without
// changing it to pointer
...
Can anyone tell me, why BCW 4.0 Linker doesn't find all non-inline functions of
class A. I put them all in the same header file as required by "Smart
Templates" option of BCW 4.0, but I get linker error: "Undfined symbol
A<int>::func (void) in module ...".
Please e-mail me.
Thanks, beforehand.
Bob.
Technical Details
Message-ID:
<NEWTNews.10770.786299039.bob@koba.elementrix.co.il>Path:
arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!howland.reston.ans.net!swiss.ans.net!elron2.elron.net!usenetShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 109fba,9c20094be12f3207,start X-Google-Attributes: gid109fba,public X-Google-Thread: fffda,9c20094be12f3207,start X-Google-Attributes: gidfffda,public X-Google-Thread: f78e5,9c20094be12f3207,start X-Google-Attributes: gidf78e5,public X-Google-Thread: 10b7bb,9c20094be12f3207,start X-Google-Attributes: gid10b7bb,public X-Google-ArrivalTime: 1994-11-30 10:34:35 PST Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!howland.reston.ans.net!swiss.ans.net!elron2.elron.net!usenet From: bob@elementrix.co.il Newsgroups: hepnet.lang.c++,ctdl.lang.c++,comp.std.c++,comp.lang.c++ Subject: How to construct class member - template object using non-default constructor ? Date: Thu, 01 Dec 94 08:10:31 PDT Organization: Elron Adar Lines: 36 Message-ID: <NEWTNews.10770.786299039.bob@koba.elementrix.co.il> NNTP-Posting-Host: koba.elementrix.co.il Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Newsreader: NEWTNews & Chameleon -- TCP/IP for MS Windows from NetManage