Thread View: gnu.g++.help
1 messages
1 total messages
Started by Dick Munroe
Fri, 14 Aug 1992 11:34
MI Weirdness needs some explaination
Author: 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.
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