B
Bret Pehrson
I don't care about the IL -- I'm talking about design. I can't get much more
plain than what I've already said.
So, it still stands, there are 2 reasons for virtual methods.
plain than what I've already said.
So, it still stands, there are 2 reasons for virtual methods.
.. said:There maybe no INTENT but you sure did modify it, B.OnStartup is no way the
same as A.OnStartup, it maybe similar but its not the same method.
If you see it as the same method where do you buy your glasses? The very
monitoring of events call is a modification. Check the IL its NOT the same.
Bret Pehrson said:Sorry, you are wrong. It is not an intent to modify behavior.
Still 2 reasons for virtual methods, anyone want to break into the limelight
and offer a third?
. said:But you have modified behaviour, you have it monitoring of events now. Thats
a modification.
Dude, you need to stop being so explicit w/ this topic.
Here is another example, where behavior is NOT changed:
class A
{
protected:
virtual void OnStartup() { }
};
class B : public A
{
protected:
virtual void OnStartup() {
log_event_no_exceptions_or_performance_penalties(); }
};
Now, if you would just look at this as the *INTENT* to not modify
behavior, but
to monitor events, you now have, get this, another reason for virtual
methods.
Let me revise my original statement (way back when):
Overriding serves multiple purposes:
- the INTENT to modify behavior
- the INTENT to monitor events (without the INTENT to modify behavior)
- probably other reasons
Is there anyone else out there reading this thread that agrees w/ me???
Hendrik Schober wrote:
Don't you consider performance to be
observable behaviour?
Performance is a *characteristic*, not a behavior.
If your program misses data on a serial
port due to this, it changes behaviour.
So a performance change _is_ a behaviour
change.
For the life of me, I can't figure out why no one seems to be able to
understand that there is more than one reason (change of behavior) for
virtual
methods.
Probably because there isn't?
[...]
Schobi
--
(e-mail address removed) is never read
I'm Schobi at suespammers dot org
"Sometimes compilers are so much more reasonable than people."
Scott Meyers