Topic: Overriding with less const


Author: lisa_lippincott@advisories.com (Lisa Lippincott)
Date: 1998/11/07
Raw View
As I read [class.virtual] paragraph 5, this is allowed:

struct X;
struct A1      { virtual const X& Foo(); };
struct B1 : A1 { virtual       X& Foo(); };

But this is not allowed:

struct A2      { virtual const int& Foo(); };
struct B2 : A2 { virtual       int& Foo(); };

Is that correct?  Is it reasonable?  Would a defect report be
appropriate?

                                         --Lisa Lippincott
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]