By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,238 Members | 1,741 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,238 IT Pros & Developers. It's quick & easy.

Overriding events...

P: n/a
I've got some descendent classes and I would like to be able to stop the
base class event from firing... How do I do that?
Nov 16 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hello!

You could to two things:

1. Override the method firing the event if it's marked as virtual
2. Declare a function with the same name and signature as "new", effectively
hiding the method in the base class.

--
venlig hilsen / with regards
anders borum
--
Nov 16 '05 #2

P: n/a
Not quite sure exactly what you mean by base class event firing, but
virtually all standard events have virtual handlers in the base class. If
you override that handler and do not explicitly invoke it in your derived
class you accomplish what I think you want to accomplish.

For example, override OnPaint() in a form rather than implementing an
explicit event handler. The same technique can be used for your own events
and classes.

Thomas P. Skinner [MVP]

"Jack Addington" <ja********@shaw.ca> wrote in message
news:uC*************@TK2MSFTNGP10.phx.gbl...
I've got some descendent classes and I would like to be able to stop the
base class event from firing... How do I do that?

Nov 16 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.