OK, I'll keep on using the example.
in class A, DoSomething() is declared as public, I thought the funciton
should be protected, since it is not used outside.
Class A is in a library, which I can't change, so I wanted to change
DoSomething() to protected in class B.
Thanks for answering the question!
WJ
"pvdg42" wrote:
>
"WJ" <WJ@discussions.microsoft.comwrote in message
news:23**********************************@microsof t.com...
If I have a class A that has a virtual public function DoSomething()
Class A
{
public:
virtual void DoSomething();
}
then I override this function to protected is class B
Class B: public Class A
{
protected:
void DoSomething();
}
Is this valid? Thanks!
WJ
Ignoring the syntax errors in your code, if your question is whether or not
it's syntactically legal in C++ (VC 8) to make the override protected, the
answer is yes. I'm interested to know what you want to achieve by doing
this, as if there is no class derived from B, it simply makes the override
version unusable.