Article View: gnu.gcc.help
Article #51929help! Trouble with private inheritance from template class
From: Diane Schulkowski
Date: Thu, 11 Mar 1993 01:19
Date: Thu, 11 Mar 1993 01:19
58 lines
2561 bytes
2561 bytes
I'm having a problems compiling (with gcc-2.0) a template class which
is privately inherited from an outside vendor's (Rogue Wave (RW))
List template class. I am wrapping the RW class with my own class
functions that simply invoke the RW classes through private
inheritance. We are doing this to centralize references to the RW
classes.
All of my functions compile (using gcc 2.0), link, and successfully
execute except for the copy constructor and the assignment operator.
These two functions are the only functions to take a const ref to my
List class as a parameter. This is an excerpt from the code:
template <class Item> // WORKS!!
List<Item>::List(const Item& FirstItem)
{
RWTValDlist<Item>::RWTValDlist();
RWTValDlist<Item>::prepend(FirstItem);
}
template <class Item>
List<Item>::List(const List<Item>& CopyList)
{
RWTValDlist<Item>::RWTValDlist(CopyList); // ERROR #1!
ListIndX = -1;
}
template <class Item>
List<Item>&
List<Item>::operator=(const List<Item>& CopyList)
{
return RWTValDlist<Item>::operator=(CopyList); // ERROR #2!
}
I get the following errors:
/usr/test/grvt/r10/work/include/List.C: In method `List<int>::List
(const class List<int>&)':
/usr/test/grvt/r10/work/include/List.C:69: too many arguments for
constructor `RWTValDlist'
/usr/test/grvt/r10/work/include/List.C: In method `class List<int>&
List<int>::operator = (const class List<int>&)':
/usr/test/grvt/r10/work/include/List.C:87: type `List<int>' is
derived from private `RWTSemDlist<int ,RWDirect<int>>'
/usr/test/grvt/r10/work/include/List.C:87: bad argument 0 for
function `List<int>::List (const class List<int>&)' (type was class
RWTSemDlist<int ,RWDirect<int>>&)
I have a similar implementation for a non-template class, and the
copy constructor works.
Does anyone know why the above does not work?
Thanks,
Diane
e-mail (schulkow@rtsg.mot.com)
Technical Details
Message-ID:
<1993Mar11.011952.11838@rtsg.mot.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!ftpbox!mothost!white!rtsg.mot.com!newsShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,62095aa01a3b88ff,start X-Google-Attributes: gid11318c,public X-Google-ArrivalTime: 1993-03-10 21:35:27 PST Newsgroups: gnu.gcc.help Path: arc1-ca.pugleaf.net!sparky!uunet!ftpbox!mothost!white!rtsg.mot.com!news From: schulkow@onyx5 (Diane Schulkowski) Subject: help! Trouble with private inheritance from template class Message-ID: <1993Mar11.011952.11838@rtsg.mot.com> Sender: news@rtsg.mot.com Nntp-Posting-Host: onyx5 Organization: Motorola Inc., Cellular Infrastructure Group Date: Thu, 11 Mar 1993 01:19:52 GMT Lines: 60