This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

class and member function with same names


The following code does not compile in egcs. I have compiled it
with cygnus compilers including 97r2. Is the code non-ANSI c++?

//   test.cc
class reset {
public:
        reset() {}
        ~reset() {}
};
 

class A {
public:
        A() {}
        ~A() {}
        int reset() const { return 0;}
};
 

main() {
        reset r;
        A a;
        a.reset();
}
// end test.cc

The message I get is

ocelot$ g++ test.cc
test.cc: In function `int main()':
test.cc:20: calling type `reset' like a method

Any pointers? Pls send me e-mail to kneelaka@painewebber.com
I am using egcs snapshot 19980608.
cheers
kumar
 

-- 
Kumar Neelakantan                       (212)713-4725
VP/Fixed Income Research                kneelaka@painewebber.com
PaineWebber Inc
 
Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]