🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by "Douglas C. Schmidt" Tue, 22 Nov 1988 01:15
g++ permits erroneous redeclaration of propated class members
#1535
Author: "Douglas C. Schmidt"
Date: Tue, 22 Nov 1988 01:15
44 lines
1539 bytes
Hi,

   I believe the following is a rather benign error on the part of g++
1.27.  AT&T cfront flags the redeclaration of the parameter types for
member Print as an error, whereas g++ doesn't complain:

----------------------------------------
class Foo {
private:
   int Y;
public:
   Foo ( int X ) {
      Y = X;
   }   
   int Print ( void ) { // declare Print as taking no parameters
      cout << "Y = " << Y << "\n";
   }
};

class Bar : Foo {
public:
   Foo::Print ( int ); // should not be accepted
};

class Foo_Bar : Bar {
public:
   Bar::Print ( double ); // ditto
};

main () {
   Foo_Bar X ( 10 ); 
   X.Print (); 
}
----------------------------------------

thanks,

Doug
----------------------------------------
schmidt@bonnie.ics.uci.edu (ARPA) |   Per me si va nella cita dolente.
                                  |   Per me si va nell' etterno dolore.
                                  |   Per me si va tra la perduta gente.
                                  |   Lasciate ogni speranza 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