Re: Virtual private and public overloaded method in sub classes
On 5/27/2010 11:54 AM, earthwormgaz wrote:
On 27 May, 16:47, Victor Bazarov<v.Abaza...@comAcast.net> wrote:
[in response to "SunCC is wrong"]
In what sense? In which part?
In issuing the warning.
No, it's not wrong. The compilers are free to issue any warnings they
want. There are some situations when they *must* issue a diagnostic, as
required by the Standard, but there is no requirement *not to* issue a
diagnostic.
FWIW, the compiler is free to issue a warning in the line of, "the
compilation of your code proceeded successfully". It's just a
diagnostic message, just like a doctor's telling you "you're healthy".
class Appender;
class Catagory {
public:
virtual bool ownsAppender(Appender* appender);
private:
virtual bool ownsAppender(Appender* appender, int& i2) throw();
};
class FixedContextCategory : public Category {
public:
virtual bool ownsAppender(Appender* appender);
};
SunCC will complain that
virtual bool Catagory::ownsAppender(Appender* appender, int& i2)
throw();
... is hidden by ...
virtual bool FixedContextCategory::ownsAppender(Appender* appender);
Full text of the warning ...
Compiling Libs/log4cpp/FixedContextCategory.cpp
"./Libs/log4cpp/log4cpp/FixedContextCategory.hh", line 171: Warning:
log4cpp::FixedContextCategory::ownsAppender hides the virtual function
log4cpp::Category::ownsAppender(log4cpp::Appender*,
__rwstd::__rb_tree<log4cpp::Appender*,
std::pair<log4cpp::Appender*const, bool>,
__rwstd::__select1st<std::pair<log4cpp::Appender*const, bool>,
log4cpp::Appender*>, std::less<log4cpp::Appender*>,
std::allocator<std::pair<log4cpp::Appender*const, bool>>>::iterator&).
1 Warning(s) detected.
SunCC doesn't *complain* per se. It is *warning* you. If you ever
think of trying to call the hidden function while in a scope that would
resolve to 'FixedContextCategory' member, you might have a problem. But
until you do, there is no problem, there is no error, the diagnostic is
totally voluntary (not required by the Standard) on SunCC's part.
V
--
I do not respond to top-posted replies, please don't ask