S
Samuel Neff
Moving to .NET from former VB6 and Java background. One thing I don't
understand is why class members are not-overridable by default. The
class author has to specifically say that a member is
virtual/overridable in order to allow another author to extend that
class and modify functionality. Why is this?
I could understand some situations where you would want members to be
final/sealed/whatever but I don't understand why this is the default
behavior.
Is there a performance reason or is it just different style? Is it
meant to make class developers think about how their class will be
used in the future more? Is it to favor composition over inheritance?
What's the history and rationale?
What are the norms regarding declaring members as virtual/overridable?
Is it common to declare all/most members this way or leave them as
final?
I understand the option to declare a member as new/shadows in a
derived class but that is even uglier and seems to just cause huge
problems--how can the behavior of the instance be governed by the type
of reference associated with it?? Rehetorical question--I'm more
concerned with the earlier ones.
Thanks,
Sam
understand is why class members are not-overridable by default. The
class author has to specifically say that a member is
virtual/overridable in order to allow another author to extend that
class and modify functionality. Why is this?
I could understand some situations where you would want members to be
final/sealed/whatever but I don't understand why this is the default
behavior.
Is there a performance reason or is it just different style? Is it
meant to make class developers think about how their class will be
used in the future more? Is it to favor composition over inheritance?
What's the history and rationale?
What are the norms regarding declaring members as virtual/overridable?
Is it common to declare all/most members this way or leave them as
final?
I understand the option to declare a member as new/shadows in a
derived class but that is even uglier and seems to just cause huge
problems--how can the behavior of the instance be governed by the type
of reference associated with it?? Rehetorical question--I'm more
concerned with the earlier ones.
Thanks,
Sam