🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Tom Keffer Wed, 13 Dec 1989 01:55
friendly access to private base classes
#708
Author: Tom Keffer
Date: Wed, 13 Dec 1989 01:55
31 lines
1293 bytes
There seems to be a difference in interpretation between cfront 2.0
and g++ in whether a friend function has access to a private base
class.  The following code compiles without protest with cfront 2.0,
but gives an error with g++ 1.36.1:

class Base {
};

class Derived : private Base {
friend void foo(Derived& d);
};

void func(Base&);

void foo(Derived& d){
  func(d);
}


Results:  
sperm[tmp]% g++ -c friend.cc
friend.cc: In function void foo (class Derived &):
friend.cc:11: type `Derived' is derived from private `Base'

-tk

---
 Dr. Thomas Keffer          | Internet: keffer@ocean.washington.edu
 Rogue Wave                 | BITNET:   keffer%ocean.washington.edu@UWAVM
 Seattle, WA 98145          | uucp:     uw-beaver!ocean.washington.edu!keffer
 (206) 523-5831             | Telemail: T.KEFFER/OMNET
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