Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3346260
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T01:16:57+00:00 2026-05-18T01:16:57+00:00

I am making an interface that has a number of events defined in it.

  • 0

I am making an interface that has a number of events defined in it. When I implement the interface in a class the events will show up. I want to force a class that implements my interface to also have to make the event handlers too. I don’t care where the class raises the event, but I want them to have to define what happens once the event is raised. Is this possible and if so, how do I do it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T01:16:58+00:00Added an answer on May 18, 2026 at 1:16 am

    Since interface define contracts rather than implementation, there’s not really a way to “force” implementations to behave in a certain way.

    That being said, I’m a little bit confused when you mention event handler within the same class as the event. Unless I’m confusing some terminology, the handlers are the methods that belong to the subscriber of the event, not the publisher. By this, do you mean something like an “On<Event>” method? If you need to expose those to something outside the class, then those can be added to the interface as well, but it would be up to the implementing class to know to tie the two together, and it seems like a somewhat peculiar design.

    If you’re looking to force some sort of behaviour like this, would something like a {abstract} base class suit your needs better than an interface?

    (ETA: You may also consider looking at the Observer pattern?)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making a simple interface that will allow a user to modify pieces of
I'm making an iOS application that has an interface in the portrait view. However,
I'm working on making an interface for a robot. My Robot class has methods
It seems that one template from Products.Five (manage_interfaces) has a bad i18n markup, making
I am making an application which will have an interface similar to Photoshop: multiple
I'm writing a C++ program that has a large number of classes. In my
Making a small WCF test program which is based on a Store that has
Apple has a nice little tutorial for making a simple master-detail interface. Interface Builder
Here's my problem... I am making a client managing interface that saves values to
I'm writing an interface that requires classes to implement a clone() method. My naive

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.