🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.lib.bug
Article #85

libg++ problem

#85
From: Phil Duncan
Date: Thu, 23 Jul 1992 15:40
47 lines
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
Technical Details
Message-ID: <9207231540.AA04437@surya.csc.ti.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!surya.CSc.ti.COM!pduncan

Show Full Headers
Complete Article Headers
Newsgroups: gnu.g++.lib.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!surya.CSc.ti.COM!pduncan
From: pduncan@surya.CSc.ti.COM (Phil Duncan)
Subject: libg++ problem
Message-ID: <9207231540.AA04437@surya.csc.ti.com>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Thu, 23 Jul 1992 15:40:09 GMT
Approved: bug-lib-g++@prep.ai.mit.edu
Lines: 48