🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by klotz Thu, 14 Sep 1989 01:01
multiple-inheritance error message bug
#418
Author: klotz
Date: Thu, 14 Sep 1989 01:01
40 lines
1202 bytes
In g++ 

The message
    % g++ mu.cc -o mu
    In function int main ():
    mu.cc:25: member `top' belongs to MI-distinct base classes `report'

Shouldn't this message be the other way around, since "top" is a class
and "report" is a member?  Also, it took me a while to figure out out that
"MI" means "multiple-inheritance," but I'm still not sure exactly what
"MI-distinct" means.  (I do understand the error itself -- in fact, I was
trying what would happen.)

Leigh.

#include <stdio.h>

struct top {
  int a = 0;
  virtual int report() { return a; };
};

struct top_left : public top {
  int a = 1;
};

struct top_right : public top {
  int a = 2;
};

struct bottom : public top_left, public top_right {
  int b;
};

main()
{
  bottom x;
  
  printf("%d\n", x.report());
}
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