Hi TT,
I guess because private is private to class and not only to outside world.
It makes sense to me..coming from C#.
--
Miha Markic - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com
"TT (Tom Tempelaere)" <_N_OSPAMtiti____@hotmail.comMAPSO_N_> wrote in
message news:dawRb.7954$EZ6.309387@phobos.telenet-ops.be...[color=blue]
> "Magnus Lidbom" <magnus_lidbom@hotmail.com> wrote in message
> news:bv61qd$om8ug$1@ID-204195.news.uni-berlin.de...[color=green]
> > Be aware that this thread is cross posted across newsgroups where
> > the topical languages have different sematics on virtual private[/color][/color]
methods.[color=blue][color=green]
> > In C# it's disallowed. I dont know why. The code below fails to compile[/color]
> with[color=green]
> > the error: "virtual or abstract members cannot be private"[/color]
>
> That is a very weird decision, and I would like to hear the rationale[/color]
behind[color=blue]
> that.
>
> Tom.
>[color=green]
> > namespace CSharp
> > {
> > public class Base
> > {
> > private virtual void Test(){}
> > }
> >
> > public abstract class Child : Base
> > {
> > private override void Test(){}
> > }
> > }
> >
> > Regards /Magnus Lidbom
> >
> >
> > "Carl Daniel [VC++ MVP]"[/color][/color]
<cpdaniel_remove_this_and_nospam@mvps.org.nospam >[color=blue][color=green]
> > wrote in message news:O70H8xO5DHA.2736@TK2MSFTNGP09.phx.gbl...[color=darkred]
> > > Frank Oquendo wrote:
> > > > Dag Henriksson wrote:
> > > >
> > > >> I prefer ususally 'private virtual', and I only use 'protected
> > > >> virtual' if I have a good reason to.
> > > >
> > > > A private method cannot be derived so what's the point of marking it
> > > > virtual?
> > >
> > > A private method most certainly CAN be overridden in a derived class.[/color][/color]
> It[color=green][color=darkred]
> > > simply can'y be CALLED from outside the class where it's first[/color][/color][/color]
declared.[color=blue][color=green][color=darkred]
> > >
> > > In the "private virtual" paradigm, an abstract base class exposes a
> > > non-virtual public interface. These non-virtual functions check and[/color]
> > inforce[color=darkred]
> > > the invariants of the class's interface (look up "design by contract"[/color][/color][/color]
if[color=blue][color=green][color=darkred]
> > > that doesn't ring a bell), and delegate to private virtual methods to
> > > perform the "meat" of the operations. Derived classes can override[/color][/color][/color]
the[color=blue][color=green][color=darkred]
> > > virtual methods to tune the behavior of the class, but since only the[/color][/color]
> base[color=green][color=darkred]
> > > class's non-virtual interface is public, everyone, including derived
> > > classes, must go through the base interface to access the class[/color][/color]
> (ensuring[color=green][color=darkred]
> > > that there are no holes in the invariant checking).
> > >
> > > -cd
> > >
> > >[/color]
> >
> >
> >
> >[/color]
>
>[/color]