Thread View: gnu.g++.lib.bug
1 messages
1 total messages
Started by Phil Duncan
Thu, 23 Jul 1992 15:40
libg++ problem
Author: Phil Duncan
Date: Thu, 23 Jul 1992 15:40
Date: Thu, 23 Jul 1992 15:40
47 lines
1727 bytes
1727 bytes
On page 23 of the libg++ documentation (first page of Chap. 6)
are directions for using void* coercion to create container classes
that share code. I tried creating a container class using
this mechanism and am getting a compiler error. Below is
the pertinent code and error message.
-------------------------------------------------------------------------
typedef Edge* EdgePtr;
typedef void* Ptr;
class PtrBag { // created by "genclass Ptr val Bag"
public:
virtual Ptr& operator () (Pix i) = 0; // access item at i
};
class PtrSLBag : public PtrBag { // created by "genclass Ptr val SLBag"
public:
Ptr& operator () (Pix i);
};
class EdgePtr_bag : public PtrSLBag { // my derived class
public:
EdgePtr& operator()(Pix i) { return (EdgePtr&)PtrSLBag::operator()(i); }
};
---------------------------------------------------------------------------
EdgePtr_bag.h:12: conflicting return type specified for virtual function `class
Edge* EdgePtr_bag::operator () (void *)'
Any help, insight, comments will be greatly appreciated.
Thanks,
Phil D.
--
Phillip J. Duncan
duncan@janet.ucla.edu ...!(uunet,ucbvax)!janet.ucla.edu!duncan
UCLA EE Dept. 56-122 Engineering IV, Los Angeles, CA 90024 (310)206-4465
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads