Stewart Gordon:
> Then you're not overriding at all. You're just declaring a function in the
> derived class
> that happens to have the same name.
I think Sean refers to the second usage of "new" in C#:
http://msdn.microsoft.com/en-us/library/51y09td4%28v=vs.71%29.aspx
Bye,
bearophile
On 13/02/2011 21:34, Sean Eskapp wrote:
Is there a way to specify that a function is nonvirtual, but can still be
"overriden" in base classes? e.g.
Then you're not overriding at all. You're just declaring a function in the derived class
that happens to have the same name.
As such, it seems
On Sun, 13 Feb 2011 16:34:04 -0500, Sean Eskapp
wrote:
Is there a way to specify that a function is nonvirtual, but can still be
"overriden" in base classes? e.g.
class A
{
void foo()
{
writeln("A");
}
}
class B : A
{
void foo()
{
writeln("B");
}
}
v
Generalizing the original question to *all* member functions, it can be
desirable to to have non-polymorphic inheritance, at least not *runtime*
polymorphic. I get the impression that it wouldn't be used much by most
people who post on these newsgroups, but there are application areas it
can
On Sunday 13 February 2011 17:40:39 bearophile wrote:
> Jonathan M Davis:
> > And honestly, in most cases, I think that what you're trying to do is
> > just plain begging for bugs. It is kind of cool that C# found a
> > relatively clean way to deal with it, but I honestly don't know what
> > it's u
Jonathan M Davis:
> And honestly, in most cases, I think that what you're trying to do is just
> plain
> begging for bugs. It is kind of cool that C# found a relatively clean way to
> deal with it, but I honestly don't know what it's useful for. I'd be worried
> about a program which overrode
On Sunday 13 February 2011 13:34:04 Sean Eskapp wrote:
> Is there a way to specify that a function is nonvirtual, but can still be
> "overriden" in base classes? e.g.
>
> class A
> {
> void foo()
> {
> writeln("A");
> }
> }
>
> class B : A
> {
> void foo()
> {
>
Is there a way to specify that a function is nonvirtual, but can still be
"overriden" in base classes? e.g.
class A
{
void foo()
{
writeln("A");
}
}
class B : A
{
void foo()
{
writeln("B");
}
}
void main()
{
(new A).foo();
(new B).foo();
}
Should