Topic: Access specifiers, two layers deep


Author: krc@wam.umd.edu (Kevin R. Coombes)
Date: Mon, 6 Apr 1992 15:52:33 GMT
Raw View
I've run into another disagreement between compilers. Here's the
simple example:

 class Base {
     public:
  int b;
 };

 class Intermediate : public Base {
     public:
  int i;
 };

 class Derived : private Intermediate {
     public;
  Intermediate::i;       // okay
  Intermediate::b;       // mysterious
  Base::b;               // error
 };

The line labelled "okay" is accepted by both compilers. The line labelled
"error" is flagged by both compilers, since it is not the name of a mem
allowed by one compiler but is flagged as an error by the other compiler.
The error message complains that there is "No type specifier for member b"
and there is an "Undeclared member name b". I've looked at the relevant
section of the ARM, but all the examples deal with immediate base classes.
Does anyone have a compelling reason for believing one of these compilers
rather than the other?

Thanks,
Kevin Coombes <krc@math.umd.edu>