Article View: gnu.g++.help
Article #179MI Weirdness needs some explaination
From: Dick Munroe
Date: Fri, 14 Aug 1992 11:34
Date: Fri, 14 Aug 1992 11:34
115 lines
2891 bytes
2891 bytes
I built a class using multiple inheritance and am getting the following message
when I compile it:
$ gcc/plusplus/include=(INC$)/noopt/debug/nolist/object=OBJ$:SQS-TK560DRIVESLOT.obj SRC$:SQS-TK560DRIVESLOT.CXX
src$:sqs-tk560driveslot.cxx: In method `SQS_TK560DriveSlot::SQS_TK560DriveSlot(int)':
src$:sqs-tk560driveslot.cxx:64: member `address' belongs to MI-distinct base classes `SQS_TSlot'
%GCC-I-NOOBJECT No object file was produced.
The inheritance looks something like follows (stuff left out for simplicity,
each class declaration is in a seperate include file.):
class SQS_TSlot
{
int a ;
public :
int address() { return a ; }
void address(int addr) { a = addr ; }
} ;
--
class SQS_TDriveSlot : public SQS_TSlot
{
public :
virtual unsigned long dismount() = 0 ; // Dismount the content of the specific drive.
virtual unsigned long dismount(struct dsc$descriptor&) = 0 ;
// Dismount the specific drive only if it contains the specified volume.
} ;
--
class SQS_TK560Slot : public SQS_TSlot
{
public :
} ;
--
class SQS_TK560DriveSlot
: public SQS_TDriveSlot,
public SQS_TK560Slot
{
public :
SQS_TK560DriveSlot(int) ;
} ;
When I try to reference the address function in the constructor for
SQS_TK560DriveSlot the above error happens.
SQS_TK560DriveSlot::SQS_TK560DriveSlot (
int addr)
{
SQS_TDriveSlot::address(addr) ;
unsigned long status = readState() ;
if (!$VMS_STATUS_SUCCESS(status))
{
lib$signal(status, 0, 0) ;
}
}
Unless I use scope resolution to eliminate the error message. The little test
case (all in one file) I put together doesn't exhibit the same behavior:
class a
{
int fa ;
public :
a(int b) : fa(b) {} ;
a() {} ;
accessa() { return fa;} ;
accessa(int a) { fa = a ; } ;
virtual foo() ;
} ;
class b
{
int fb ;
public :
accessb() { return fb ;} ;
accessb(int b) { fb = b ; } ;
} ;
class c : public a
{
int fc ;
public :
} ;
class d : public b, public c
{
public :
d(int addr) { accessa(addr) ; } ;
foo() ;
} ;
d::d(int addr) { accessa(addr) ; } ;
d::foo()
{
printf("%d",accessa()) ;
return 1 ;
}
Can someone explain what's going on (or have I hit a snag in the compiler)?
Thanks for the help.
--
Dick Munroe Internet: munroe@dmc.com
Doyle Munroe Consultants, Inc. UUCP: ...uunet!thehulk!munroe
267 Cox St. Office: (508) 568-1618
Hudson, Ma. FAX: (508) 562-1133
GET CONNECTED!!! Send mail to info@dmc.com to find out about DMConnection.
Technical Details
Message-ID:
<1992Aug14.073439.4427@dmc.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!dmc.com!munroeShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!dmc.com!munroe From: munroe@dmc.com (Dick Munroe) Newsgroups: gnu.g++.help Subject: MI Weirdness needs some explaination Message-ID: <1992Aug14.073439.4427@dmc.com> Date: 14 Aug 92 07:34:39 EDT Organization: Doyle, Munroe Consultants, Inc., Hudson, MA Lines: 115