🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Paul N. Hilfinger Wed, 27 Jan 1993 02:50
Access control error?
#1429
Author: Paul N. Hilfinger
Date: Wed, 27 Jan 1993 02:50
45 lines
1997 bytes
The following program compiles without error under gcc-2.3.3.  It
should instead give an error message, since f is not accessible
through D.  Substituting the commented-out declaration of x causes gcc
to correctly identify an error.  For some reason, the extra level of
derivation makes a difference.

P. Hilfinger

Session:

% gcc-2.3.3 -v -Wall -o misc misc.C
Reading specs from /usr/sww/lib/gcc-lib/sparc-sun-sunos4.1/2.3.3/specs
gcc version 2.3.3
 /usr/sww/lib/gcc-lib/sparc-sun-sunos4.1/2.3.3/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -Dsparc -Dsun -Dunix -D__sparc__ -D__sun__ -D__unix__ -D__sparc -D__sun -D__unix -Wall misc.C /usr/tmp/cca04944.i
GNU CPP version 2.3.3 (sparc)
 /usr/sww/lib/gcc-lib/sparc-sun-sunos4.1/2.3.3/cc1plus /usr/tmp/cca04944.i -quiet -dumpbase misc.cc -Wall -version -o /usr/tmp/cca04944.s
GNU C++ version 2.3.3 (sparc) compiled by GNU C version 2.3.3.
 as -o /usr/tmp/cca049441.o /usr/tmp/cca04944.s
 /usr/sww/lib/gcc-lib/sparc-sun-sunos4.1/2.3.3/ld -e start -dc -dp -o misc /lib/crt0.o -L/usr/sww/lib/gcc-lib/sparc-sun-sunos4.1/2.3.3 -L/usr/sww/lib /usr/tmp/cca049441.o -lgcc -lc -lgcc
% 

Source: 

------------------------------cut here----------------------------------------
class A {
public:
    virtual void f() {}
};

class C: public A {
private:
    void f() {  }
};

class D : public C {
};

int main()
{
    D* x = new D;
//  C* x = new C;

    x -> f();
    return 0;
}
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