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 7806465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T02:32:43+00:00 2026-06-02T02:32:43+00:00

I have a class ‘b’ that inherits from class ‘a’. In class ‘a’ there

  • 0

I have a class ‘b’ that inherits from class ‘a’. In class ‘a’ there is some code that performs an action if an event is not null. I need that code to fire in class ‘b’ during specific times in the application. So in ‘b’ I subscribed to a new Handler(event).

If I leave the autogenerated event ‘as is’ in class ‘b’ with the throw new NotImplementedException(); line, the code works/runs as expected. As soon as I remove the thow exception, the application no longer works as expected.

So, what is the throw new NotImplementedException doing besides throwing the exception?

I realize I’m probably trying to solve my coding problem the wrong way at this point, and I am sure I will find a better way to do it (I’m still learning), but my question remains. Why does that line change the outcome of code?

EDIT:
I reallize I wan’t very specific with my code. Unfortunately, because of strict policies, I can’t be. I have in class ‘a’ an if statement.

if (someEvent != null)

When the code ‘works’, the if statement is returning true. When it isn’t working as expected, it is returning ‘false’. In class ‘b’, the only time the application ‘works’ (or the if statement returns true), is when I have the throw new NotImplementedException(); line in class ‘b’s event method that is autogenerated when I attached the new event.

  • 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-06-02T02:32:45+00:00Added an answer on June 2, 2026 at 2:32 am

    It is simply an exception, as for why it means your application “works” is entirely dependent on the code handling any exceptions.

    It is not a “special” exception as opposed to a normal exception (other than being derived from Exception like the rest). You tend to see it with code generation as a placeholder for implementing the member it is throwing inside. It is a lot easier to do this than have code generation try to understand the member structure in order to output compiling code.

    When you say “no longer works as expected”, I am assuming it compiles. If removing this stops the code from compiling then the chances are good you have a compilation error about a return value.

    Perhaps the code that triggers the event expects a certain response from handlers, or if there are no handlers or exceptions occur it defaults the response and carries on. In your case, there is a handler and no exception so it expects a better response?

    Complete guesswork.

    If there is code in a that you need to use in b, consider making the method that houses the code protected and optionally virtual if you need to override the behaviour.

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

Sidebar

Related Questions

I have class ParentClass that observes an NSNotification. ParentClass handles the notification. ChildClass inherits
I have class A that derives from System.Data.Objects.DataClasses.EntityObject . When I try to serialize
I have class MyForm which inherited from QMainWindow . Here's my code: std::auto_ptr<MyForm> pForm(new
I have class that I believe should not be a singleton or static class.
I have class A, which exposes an event. an object of class B subscribed
I have class that represents users. Users are divided into two groups with different
I have class class DateOptTimeType implements org.hibernate.usertype.UserType that works with two columns @org.hibernate.annotations.Type(type =
I have class X and in it there is a static method called doStuff()
I have class MasterData whose instances contain some general information about all possible gadgets.
I have class B that has class A, this is simplified version of class

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.