🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

2 total messages Started by kenneth baclawski Wed, 04 Oct 1989 00:29
(none)
#461
Author: kenneth baclawski
Date: Wed, 04 Oct 1989 00:29
24 lines
1197 bytes
/*
     Problem with protected members in GNU C++

Compilation:
g++ -v -c protect.c
g++ version 1.35.1-
 /kens-disk/k/gnu/lib/gcc-cpp -+ -v -undef -D__GNU__ -D__GNUG__ -D__cplusplus -Dmc68000 -Dsun -Dunix -D__mc68000__ -D__sun__ -D__unix__ -D__HAVE_68881__ -Dmc68020 protect.c /tmp/cca08429.cpp
GNU CPP version 1.35
 /kens-disk/k/gnu/lib/gcc-cc1plus /tmp/cca08429.cpp -quiet -dumpbase protect.c -noreg -version -o /tmp/cca08429.s
GNU C++ version 1.35.1- (68k, MIT syntax) compiled by GNU C version 1.35.
In method struct derived *derived::derived (struct base &):
protect.c:10: member `a' is a protected member of class `base'

*/

class base {
protected:
  int a;
};

class derived : public base {
public:
  derived (base& y) { a = y.a; }
};
Re: (none)
#465
Author: Doug Schmidt
Date: Wed, 04 Oct 1989 04:30
37 lines
2016 bytes
In article <8910040029.AA01293@flora.CCS.Northeastern.EDU>, kenb@flora (kenneth baclawski) writes:
>/*
>     Problem with protected members in GNU C++
>
>Compilation:
>g++ -v -c protect.c
>g++ version 1.35.1-
> /kens-disk/k/gnu/lib/gcc-cpp -+ -v -undef -D__GNU__ -D__GNUG__ -D__cplusplus -Dmc68000 -Dsun -Dunix -D__mc68000__ -D__sun__ -D__unix__ -D__HAVE_68881__ -Dmc68020 protect.c /tmp/cca08429.cpp
>GNU CPP version 1.35
> /kens-disk/k/gnu/lib/gcc-cc1plus /tmp/cca08429.cpp -quiet -dumpbase protect.c -noreg -version -o /tmp/cca08429.s
>GNU C++ version 1.35.1- (68k, MIT syntax) compiled by GNU C version 1.35.
>In method struct derived *derived::derived (struct base &):
>protect.c:10: member `a' is a protected member of class `base'
>
>*/
>
>class base {
>protected:
>  int a;
>};
>
>class derived : public base {
>public:
>  derived (base& y) { a = y.a; }
>};

This is not a bug, it is a `feature.'  Check out how C++ 2.0 does it
and you should get the same complaint.  See libg++ code for examples
of how to `work-around' this `feature.'  Or complain about it on
comp.lang.c++ ;-)

Doug
--
schmidt@ics.uci.edu (ARPA) |   Per me si va nella citta' dolente.
office: (714) 856-4043     |   Per me si va nell'eterno dolore.
                           |   Per me si va tra la perduta gente.
                           |   Lasciate ogni speranza o voi ch'entrate.
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